← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3476: don't overwrite imposed fluid pressure when initializing the values (more flexible) + a function ...

 

------------------------------------------------------------
revno: 3476
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
timestamp: Wed 2014-10-15 10:42:29 +0200
message:
  don't overwrite imposed fluid pressure when initializing the values (more flexible) + a function returning barycenter + improved "locate" for interpolation
modified:
  lib/triangulation/FlowBoundingSphere.hpp
  lib/triangulation/FlowBoundingSphere.ipp


--
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 'lib/triangulation/FlowBoundingSphere.hpp'
--- lib/triangulation/FlowBoundingSphere.hpp	2014-10-15 06:44:01 +0000
+++ lib/triangulation/FlowBoundingSphere.hpp	2014-10-15 08:42:29 +0000
@@ -127,6 +127,7 @@
 		//return the list of constriction values
 		vector<double> getConstrictions();
 		vector<Constriction> getConstrictionsFull();
+		CVector cellCenter(CellHandle& cell);
 
 		void generateVoxelFile ( );
 		

=== modified file 'lib/triangulation/FlowBoundingSphere.ipp'
--- lib/triangulation/FlowBoundingSphere.ipp	2014-10-10 11:45:21 +0000
+++ lib/triangulation/FlowBoundingSphere.ipp	2014-10-15 08:42:29 +0000
@@ -424,6 +424,14 @@
 }
 
 template <class Tesselation> 
+CVector FlowBoundingSphere<Tesselation>::cellCenter(CellHandle& cell)
+{
+	CVector center ( 0,0,0 );
+	for ( int k=0;k<4;k++ ) center= center + 0.25* (cell->vertex(k)->point()-CGAL::ORIGIN);
+	return center;
+}
+
+template <class Tesselation> 
 void FlowBoundingSphere<Tesselation>::interpolate(Tesselation& Tes, Tesselation& NewTes)
 {
         CellHandle oldCell;
@@ -435,14 +443,12 @@
 		if (newCell->info().fictious()==0) for ( int k=0;k<4;k++ ) center= center + 0.25* (Tes.vertex(newCell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
 		else {
 			Real boundPos=0; int coord=0;
-			for ( int k=0;k<4;k++ ) {
-				if (!newCell->vertex (k)->info().isFictious) center= center+0.3333333333*(Tes.vertex(newCell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
-				else {
+			for ( int k=0;k<4;k++ ) if (!newCell->vertex (k)->info().isFictious) center= center+(1./(4.-newCell->info().fictious()))*(Tes.vertex(newCell->vertex(k)->info().id())->point()-CGAL::ORIGIN);
+			for ( int k=0;k<4;k++ ) if (newCell->vertex (k)->info().isFictious) {
 					coord=boundary (newCell->vertex(k)->info().id()).coordinate;
 					boundPos=boundary (newCell->vertex(k)->info().id()).p[coord];
+					center=CVector(coord==0?boundPos:center[0],coord==1?boundPos:center[1],coord==2?boundPos:center[2]);
 				}
-			}
-			center=CVector(coord==0?boundPos:center[0],coord==1?boundPos:center[1],coord==2?boundPos:center[2]);
 		}
                 oldCell = Tri.locate(Point(center[0],center[1],center[2]));
 		newCell->info().getInfo(oldCell->info());
@@ -750,8 +756,9 @@
         FiniteCellsIterator cellEnd = Tri.finite_cells_end();
 
         for (FiniteCellsIterator cell = Tri.finite_cells_begin(); cell != cellEnd; cell++){
-		cell->info().p() = pZero; cell->info().dv()=0;}
-
+		if (!cell->info().Pcondition) cell->info().p() = pZero;
+		cell->info().dv()=0;
+	}
         for (int bound=0; bound<6;bound++) {
                 int& id = *boundsIds[bound];
 		boundingCells[bound].clear();