From 82ccbfe36b8fa714ef5ea42571714d79109c64c5 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Fri, 27 Apr 2018 15:24:38 +0200
Subject: [PATCH] Fixes time step in dimension greater than 1

---
 src/scheme/AcousticSolver.hpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/scheme/AcousticSolver.hpp b/src/scheme/AcousticSolver.hpp
index 3d2f79fe7..03488f21c 100644
--- a/src/scheme/AcousticSolver.hpp
+++ b/src/scheme/AcousticSolver.hpp
@@ -308,8 +308,16 @@ public:
   KOKKOS_INLINE_FUNCTION
   double acoustic_dt(const Kokkos::View<const double*>& Vj,
 		     const Kokkos::View<const double*>& cj) const {
+    const Kokkos::View<const double**> ljr = m_mesh_data.ljr();
+    const Kokkos::View<const unsigned short*>& cell_nb_nodes
+      = m_connectivity.cellNbNodes();
+
     Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){
-	m_Vj_over_cj[j] = Vj[j]/cj[j];
+	double S = 0;
+	for (int r=0; r<cell_nb_nodes(j); ++r) {
+	  S += ljr(j,r);
+	}
+	m_Vj_over_cj[j] = 2*Vj[j]/(S*cj[j]);
       });
 
     double dt = std::numeric_limits<double>::max();
-- 
GitLab