From 69263c8d06dba145d8439cd88203cacf3938f55f Mon Sep 17 00:00:00 2001
From: Fanny CHOPOT <fanny.chopot.ocre@cea.fr>
Date: Thu, 26 Apr 2018 13:16:03 +0200
Subject: [PATCH] execution en parallele ok

---
 src/main.cpp                          | 5 +++--
 src/mesh/MeshData.hpp                 | 4 ++++
 src/scheme/FiniteVolumesDiffusion.hpp | 8 ++++----
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index 41953c8c1..e122cb5b9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -161,17 +161,18 @@ int main(int argc, char *argv[])
 	dt=tmax-t;
       }
 
-      std::cout << "t=" <<  t << " dt=" << dt << '\n';
+      //std::cout << "t=" <<  t << " dt=" << dt << '\n';
       //acoustic_solver.computeNextStep(t,dt, unknowns);
       finite_volumes_diffusion.computeNextStep(t, dt, unknowns);
       
+      
       block_eos.updatePandCFromRhoE();    
     
       t += dt;
       ++iteration;
     }
 
-    std::cout << "* " << rang::style::underline << "Final time" << rang::style::reset
+     std::cout << "* " << rang::style::underline << "Final time" << rang::style::reset
 	      << ":  " << rang::fgB::green << t << rang::fg::reset << " (" << iteration << " iterations)\n";
 
     //method_cost_map["AcousticSolverWithMesh"] = timer.seconds();
diff --git a/src/mesh/MeshData.hpp b/src/mesh/MeshData.hpp
index 8778e5a4c..3e8a30a82 100644
--- a/src/mesh/MeshData.hpp
+++ b/src/mesh/MeshData.hpp
@@ -98,6 +98,10 @@ private:
 	}
 	m_Vl[l] =  sum_cjr_xj; 
       });
+    //for (int l=0; l<m_mesh.numberOfFaces(); ++l) {
+    //std::cout << "Vj(" << l << ") = " << m_Vl(l) << std::endl;
+    //}
+    //std::exit(0);
   }
 
   KOKKOS_INLINE_FUNCTION
diff --git a/src/scheme/FiniteVolumesDiffusion.hpp b/src/scheme/FiniteVolumesDiffusion.hpp
index c91d7b6b1..93440138c 100644
--- a/src/scheme/FiniteVolumesDiffusion.hpp
+++ b/src/scheme/FiniteVolumesDiffusion.hpp
@@ -90,7 +90,7 @@ private:
     const Kokkos::View<const double*>& Vl = m_mesh_data.Vl();
 
     Kokkos::parallel_for(m_mesh.numberOfFaces(), KOKKOS_LAMBDA(const int& l) {
-        Rdd sum;
+        Rdd sum = zero;
 	for (int j=0; j<face_nb_cells(l); ++j) {
 	  int cell_here = face_cells(l,j);
 	  int local_face_number_in_cell = face_cell_local_face(l,j);
@@ -134,7 +134,6 @@ private:
 
       });
 
-
     return m_Gl ;
   }
 
@@ -208,7 +207,7 @@ public:
 	  minVl = std::min(minVl, Vl(cell_faces(j, ll)));
 	}
 	// k=1 => (kj(j+1) + 2*kj(j) + kj(j-1)) = 4
-       	dt_j[j]= 0.5*rhoj(j)*Vj(j)*(2./4)*minVl;
+       	dt_j[j]= 0.5*rhoj(j)*Vj(j)*(2./4.)*minVl;
       });
     
     // for (int j=0; j<m_mesh.numberOfCells(); ++j) {
@@ -263,7 +262,7 @@ public:
 	  energy_fluxes   += (Gl(l), Cjr(j,R));
 	}
 	uj[j] -= (dt*inv_mj[j]) * momentum_fluxes;
-	Ej[j] -= (dt*inv_mj[j]) * energy_fluxes;
+       	Ej[j] -= (dt*inv_mj[j]) * energy_fluxes;
       });
 
     // Calcul de e par la formule e = E-0.5 u^2 
@@ -278,6 +277,7 @@ public:
     const Kokkos::View<const double*> mj = unknowns.mj();
     Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){
 	rhoj[j] = mj[j]/Vj[j];
+
       });
   }
 };
-- 
GitLab