← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3412: a temporary save, change waterReservoir=bound[2], add invadeBounday option

 

------------------------------------------------------------
revno: 3412
committer: Chao Yuan <chaoyuan2012@xxxxxxxxx>
timestamp: Fri 2014-03-28 19:04:58 +0100
message:
  a temporary save, change waterReservoir=bound[2], add invadeBounday option
modified:
  pkg/dem/UnsaturatedEngine.cpp
  pkg/dem/UnsaturatedEngine.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/UnsaturatedEngine.cpp'
--- pkg/dem/UnsaturatedEngine.cpp	2014-03-28 10:58:02 +0000
+++ pkg/dem/UnsaturatedEngine.cpp	2014-03-28 18:04:58 +0000
@@ -204,8 +204,8 @@
     RTriangulation& tri = flow->T[flow->currentTes].Triangulation();
     Finite_cells_iterator cell_end = tri.finite_cells_end();
     for ( Finite_cells_iterator cell = tri.finite_cells_begin(); cell != cell_end; cell++ ) {
-      if (cell->info().isAirReservoir==true) cell->info().p()=bndCondValue[2];
-      if (cell->info().isWaterReservoir==true) cell->info().p()=bndCondValue[3];
+      if (cell->info().isWaterReservoir==true) cell->info().p()=bndCondValue[2];
+      if (cell->info().isAirReservoir==true) cell->info().p()=bndCondValue[3];
     } 
 }
 
@@ -221,39 +221,38 @@
 void UnsaturatedEngine::updateWaterReservoir(Solver& flow)
 {
     initWaterReservoirBound(flow);
-    for (int bound=0; bound<6; bound++) {
-        if (flow->boundingCells[bound].size()==0) continue;
-        vector<Cell_handle>::iterator it = flow->boundingCells[bound].begin();
-        for ( it ; it != flow->boundingCells[bound].end(); it++) {
-            if ((*it)->info().index == 0) continue;
-            waterReservoirRecursion((*it),flow);
-        }
+    vector<Cell_handle>::iterator it = flow->boundingCells[2].begin();
+    for ( it ; it != flow->boundingCells[2].end(); it++) {
+        if ((*it)->info().index == 0) continue;
+        waterReservoirRecursion((*it),flow);
     }
 }
-template<class Solver>//the boundingCells[3] should always connect water reservoir && isWaterReservoir=true
-void UnsaturatedEngine::initWaterReservoirBound(Solver& flow/*, int boundN*/)
+template<class Solver>//boundingCells[2] is water reservoir. 
+void UnsaturatedEngine::initWaterReservoirBound(Solver& flow)
 {
     RTriangulation& tri = flow->T[flow->currentTes].Triangulation();
     Finite_cells_iterator cell_end = tri.finite_cells_end();
     for ( Finite_cells_iterator cell = tri.finite_cells_begin(); cell != cell_end; cell++ ) {
         cell->info().isWaterReservoir = false;
     }
-    for (int bound=0; bound<6; bound++) {
-        if (flow->boundingCells[bound].size()==0) continue;
-        vector<Cell_handle>::iterator it = flow->boundingCells[bound].begin();
-        for ( it ; it != flow->boundingCells[bound].end(); it++) {
-            if ((*it)->info().index == 0) continue;
-            if((*it)->info().p() == bndCondValue[3])
-                (*it)->info().isWaterReservoir = true;
-        }
-    }
+    if (flow->boundingCells[2].size()==0) {
+        cerr<<"set bndCondIsPressure[2] true. boundingCells.size=0!";
+        continue;
+    }
+    vector<Cell_handle>::iterator it = flow->boundingCells[2].begin();
+    for ( it ; it != flow->boundingCells[2].end(); it++) {
+        if ((*it)->info().index == 0) continue;
+        if((*it)->info().p() == bndCondValue[2])
+            (*it)->info().isWaterReservoir = true;
+    }
+
 }
 template<class Solver>
 void UnsaturatedEngine::waterReservoirRecursion(Cell_handle cell, Solver& flow)
 {
     for (int facet = 0; facet < 4; facet ++) {
         if (flow->T[flow->currentTes].Triangulation().is_infinite(cell->neighbor(facet))) continue;
-        if (cell->neighbor(facet)->info().p() != bndCondValue[3]) continue;
+        if (cell->neighbor(facet)->info().p() != bndCondValue[2]) continue;
         if (cell->neighbor(facet)->info().isWaterReservoir==true) continue;
         Cell_handle n_cell = cell->neighbor(facet);
         n_cell->info().isWaterReservoir = true;
@@ -265,16 +264,13 @@
 void UnsaturatedEngine::updateAirReservoir(Solver& flow)
 {
     initAirReservoirBound(flow);
-    for (int bound=0; bound<6; bound++) {
-        if (flow->boundingCells[bound].size()==0) continue;
-        vector<Cell_handle>::iterator it = flow->boundingCells[bound].begin();
-        for ( it ; it != flow->boundingCells[bound].end(); it++) {
-            if ((*it)->info().index == 0) continue;
-            airReservoirRecursion((*it),flow);
-        }
+    vector<Cell_handle>::iterator it = flow->boundingCells[3].begin();
+    for ( it ; it != flow->boundingCells[3].end(); it++) {
+        if ((*it)->info().index == 0) continue;
+        airReservoirRecursion((*it),flow);
     }
 }
-template<class Solver>//the boundingCells[2] should always connect air reservoir && isAirReservoir=true
+template<class Solver>//boundingCells[3] is air reservoir
 void UnsaturatedEngine::initAirReservoirBound(Solver& flow)
 {
     RTriangulation& tri = flow->T[flow->currentTes].Triangulation();
@@ -282,14 +278,15 @@
     for ( Finite_cells_iterator cell = tri.finite_cells_begin(); cell != cell_end; cell++ ) {
         cell->info().isAirReservoir = false;
     }
-    for (int bound=0; bound<6; bound++) {
-        if (flow->boundingCells[bound].size()==0) continue;
-        vector<Cell_handle>::iterator it = flow->boundingCells[bound].begin();
-        for ( it ; it != flow->boundingCells[bound].end(); it++) {
-            if((*it)->info().index == 0) continue;
-            if((*it)->info().p() == bndCondValue[2])
-                (*it)->info().isAirReservoir = true;
-        }
+    if (flow->boundingCells[3].size()==0) {
+        cerr<<"set bndCondIsPressure[3] true. boundingCells.size=0!";
+        continue;
+    }
+    vector<Cell_handle>::iterator it = flow->boundingCells[3].begin();
+    for ( it ; it != flow->boundingCells[bound].end(); it++) {
+        if((*it)->info().index == 0) continue;
+        if((*it)->info().p() == bndCondValue[3])
+            (*it)->info().isAirReservoir = true;
     }
 }
 template<class Solver>
@@ -297,7 +294,7 @@
 {
     for (int facet = 0; facet < 4; facet ++) {
         if (flow->T[flow->currentTes].Triangulation().is_infinite(cell->neighbor(facet))) continue;
-        if (cell->neighbor(facet)->info().p() != bndCondValue[2]) continue;
+        if (cell->neighbor(facet)->info().p() != bndCondValue[3]) continue;
         if (cell->neighbor(facet)->info().isAirReservoir == true) continue;
         Cell_handle n_cell = cell->neighbor(facet);
         n_cell->info().isAirReservoir = true;

=== modified file 'pkg/dem/UnsaturatedEngine.hpp'
--- pkg/dem/UnsaturatedEngine.hpp	2014-03-28 10:58:02 +0000
+++ pkg/dem/UnsaturatedEngine.hpp	2014-03-28 18:04:58 +0000
@@ -190,6 +190,7 @@
 
 					((bool, pressureForce, true,,"Compute the pressure field and associated fluid forces. WARNING: turning off means fluid flow is not computed at all."))
 					((bool, computeForceActivated, true,,"Activate capillary force computation. WARNING: turning off means capillary force is not computed at all, but the drainage can still work."))
+					((bool, invadeBoundary, false,,"Invade from boundaries."))
 					,
 					/*deprec*/
 					,,