← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3414: a small change for check reservoir boundingCells.

 

------------------------------------------------------------
revno: 3414
committer: cyuan <chaoyuan2012@xxxxxxxxx>
timestamp: Sun 2014-03-30 00:32:02 +0100
message:
  a small change for check reservoir boundingCells.
modified:
  pkg/dem/UnsaturatedEngine.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/UnsaturatedEngine.cpp'
--- pkg/dem/UnsaturatedEngine.cpp	2014-03-29 15:55:08 +0000
+++ pkg/dem/UnsaturatedEngine.cpp	2014-03-29 23:32:02 +0000
@@ -1113,19 +1113,36 @@
 void UnsaturatedEngine::saveReservoirInfo(Solver& flow,int boundN)
 {
     if(flow->boundingCells[boundN].size()==0) {
-        cerr << "please set corresponding bndCondIsPressure[bound] to true ."<< endl;
+        cerr << "please set corresponding bndCondIsPressure[bound] to be true ."<< endl;
     }
     else {
-        ofstream file;
-        file.open("reservoirInfo.txt");//FIXME:how to name a text file with varieables?
-        file << "#Checking the reservoir cells statement";
-        file << "Cell_ID"<<"	Cell_Pressure"<<"	isAirReservoir"<<"	isWaterReservoir"<<endl;
-        vector<Cell_handle>::iterator it = flow->boundingCells[boundN].begin();
-        for ( it ; it != flow->boundingCells[boundN].end(); it++) {
-            if ((*it)->info().index == 0) continue;
-            file << (*it)->info().index <<" "<<(*it)->info().p()<<" "<<(*it)->info().isAirReservoir<<" "<<(*it)->info().isWaterReservoir<<endl;
-        }
-        file.close();
+        if (boundN==2) {
+            ofstream file;
+            file.open("waterReservoirBoundInfo.txt");
+            file << "#Checking the water reservoir cells statement";
+            file << "Cell_ID"<<"	Cell_Pressure"<<"	isAirReservoir"<<"	isWaterReservoir"<<endl;
+            vector<Cell_handle>::iterator it = flow->boundingCells[boundN].begin();
+            for ( it ; it != flow->boundingCells[boundN].end(); it++) {
+                if ((*it)->info().index == 0) continue;
+                file << (*it)->info().index <<" "<<(*it)->info().p()<<" "<<(*it)->info().isAirReservoir<<" "<<(*it)->info().isWaterReservoir<<endl;
+            }
+            file.close();
+        }
+        else if (boundN==3) {
+            ofstream file;
+            file.open("airReservoirBoundInfo.txt");
+            file << "#Checking the air reservoir cells statement";
+            file << "Cell_ID"<<"	Cell_Pressure"<<"	isAirReservoir"<<"	isWaterReservoir"<<endl;
+            vector<Cell_handle>::iterator it = flow->boundingCells[boundN].begin();
+            for ( it ; it != flow->boundingCells[boundN].end(); it++) {
+                if ((*it)->info().index == 0) continue;
+                file << (*it)->info().index <<" "<<(*it)->info().p()<<" "<<(*it)->info().isAirReservoir<<" "<<(*it)->info().isWaterReservoir<<endl;
+            }
+            file.close();
+        }
+        else {
+            cerr<<"This is not a reservoir boundary. Please set boundN to be 2(waterReservoirBound) or 3(airReservoirBound)."<<endl;
+        }
     }
 }