← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 4037: Fixed bug with multithread+compressible flow and addressed backgroundAction() FIXME for eigenSolve()

 

------------------------------------------------------------
revno: 4037
committer: robcaulk <rob.caulk@xxxxxxxxx>
timestamp: Tue 2017-05-02 09:03:45 -0700
message:
  Fixed bug with multithread+compressible flow and addressed backgroundAction() FIXME for eigenSolve()
modified:
  lib/triangulation/FlowBoundingSphereLinSolv.hpp
  lib/triangulation/FlowBoundingSphereLinSolv.ipp
  pkg/pfv/FlowEngine.ipp.in


--
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/FlowBoundingSphereLinSolv.hpp'
--- lib/triangulation/FlowBoundingSphereLinSolv.hpp	2014-10-29 16:49:20 +0000
+++ lib/triangulation/FlowBoundingSphereLinSolv.hpp	2017-05-02 16:03:45 +0000
@@ -61,6 +61,7 @@
 	bool isFullLinearSystemGSSet;
 	bool areCellsOrdered;//true when orderedCells is filled, turn it false after retriangulation
 	bool updatedRHS;
+	bool factorizeOnly;  // used for backgroundAction()
 	
 	#ifdef EIGENSPARSE_LIB
 	//Eigen's sparse matrix and solver

=== modified file 'lib/triangulation/FlowBoundingSphereLinSolv.ipp'
--- lib/triangulation/FlowBoundingSphereLinSolv.ipp	2016-11-16 09:53:52 +0000
+++ lib/triangulation/FlowBoundingSphereLinSolv.ipp	2017-05-02 16:03:45 +0000
@@ -527,10 +527,13 @@
 		}
 		factorizedEigenSolver = true;
 	}
-	openblas_set_num_threads(numSolveThreads);
-	ex = eSolver.solve(eb);
-	for (int k=0; k<ncols; k++) T_x[k]=ex[k];
-	copyLinToCells();
+	// backgroundAction only wants to factorize, no need to solve and copy to cells.
+	if (!factorizeOnly){
+		openblas_set_num_threads(numSolveThreads);
+		ex = eSolver.solve(eb);
+		for (int k=0; k<ncols; k++) T_x[k]=ex[k];
+		copyLinToCells();
+	}
 #else
 	cerr<<"Flow engine not compiled with eigen, nothing computed if useSolver=3"<<endl;
 #endif

=== modified file 'pkg/pfv/FlowEngine.ipp.in'
--- pkg/pfv/FlowEngine.ipp.in	2016-11-17 15:32:26 +0000
+++ pkg/pfv/FlowEngine.ipp.in	2017-05-02 16:03:45 +0000
@@ -150,9 +150,10 @@
 {
 	if (useSolver<1) {LOG_ERROR("background calculations not available for Gauss-Seidel"); return;}
         buildTriangulation ( pZero,*backgroundSolver );
-	//FIXME: GS is computing too much, we need only matrix factorization in fact
+	backgroundSolver->factorizeOnly = true;
 	backgroundSolver->gaussSeidel(scene->dt);
-	//FIXME(2): and here we need only cached variables, not forces
+	backgroundSolver->factorizeOnly = false;
+	//FIXME(2): and here we need only cached variables, not forces <- this appears to be fixed already inside computeFacetForcesWithCache
 	backgroundSolver->computeFacetForcesWithCache(/*onlyCache?*/ true);
 // 	boost::this_thread::sleep(boost::posix_time::seconds(5));
  	backgroundCompleted = true;
@@ -279,6 +280,7 @@
 
         boundaryConditions ( flow );
         flow.initializePressure ( pZero );
+	if (multithread && fluidBulkModulus>0) initializeVolumes(flow);  // needed for multithreaded compressible flow (https://bugs.launchpad.net/yade/+bug/1687355)
 	
         if ( !first && !multithread && (useSolver==0 || fluidBulkModulus>0 || doInterpolate)) flow.interpolate ( flow.T[!flow.currentTes], flow.tesselation() );
         if ( waveAction ) flow.applySinusoidalPressure ( flow.tesselation().Triangulation(), sineMagnitude, sineAverage, 30 );