diff --git a/src/mesh/MeshData.hpp b/src/mesh/MeshData.hpp index bd318f33d5c4437a649a70267f087e3a14d9c164..480f72453c459033d4d3c5456f5b74d47b7a73a0 100644 --- a/src/mesh/MeshData.hpp +++ b/src/mesh/MeshData.hpp @@ -22,7 +22,7 @@ private: Kokkos::View<Rd**> m_Cjr; Kokkos::View<Rd*> m_xj; Kokkos::View<double*> m_Vj; - Kokkos::View<double*> m_Dj; + Kokkos::View<double*> m_Vl; KOKKOS_INLINE_FUNCTION void _updateCenter() @@ -73,22 +73,29 @@ private: } // Ajout fonction pour calculer h_i+1/2 - // PROBLEME Dj negatif parfois ! KOKKOS_INLINE_FUNCTION void _updateVolumeCenter() { const Kokkos::View<const unsigned int**>& cell_nodes = m_mesh.connectivity().cellNodes(); - const Kokkos::View<const unsigned short*> cell_nb_nodes - = m_mesh.connectivity().cellNbNodes(); + const Kokkos::View<const unsigned short*> face_nb_cells + = m_mesh.connectivity().faceNbCells(); + + const Kokkos::View<const unsigned short**> face_cell_local_face + = m_mesh.connectivity().faceCellLocalFace(); + + const Kokkos::View<const unsigned short*> cell_nb_faces + = m_mesh.connectivity().cellNbFaces(); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ double sum_cjr_xj = 0; - for (int R=0; R<cell_nb_nodes[j]; ++R) { - sum_cjr_xj += (m_xj[cell_nodes(j,R)], m_Cjr(j,R)); + for (int l=0; l<cell_nb_faces(j); ++l) { + for (int R=0; R<face_nb_cells[l]; R++) { + sum_cjr_xj += (m_xj[cell_nodes(j,R)], m_Cjr(j,face_cell_local_face(l,R))); + } } - m_Dj[j] = inv_dimension * sum_cjr_xj; + m_Vl[j] = inv_dimension * sum_cjr_xj; }); } @@ -126,9 +133,9 @@ public: return m_Vj; } - const Kokkos::View<const double*> Dj() const + const Kokkos::View<const double*> Vl() const { - return m_Dj; + return m_Vl; } void updateAllData() @@ -144,7 +151,7 @@ public: m_Cjr("Cjr", mesh.numberOfCells(), mesh.connectivity().maxNbNodePerCell()), m_xj("xj", mesh.numberOfCells()), m_Vj("Vj", mesh.numberOfCells()), - m_Dj("Dj", mesh.numberOfCells()) + m_Vl("Vl", mesh.numberOfCells()) { if (dimension==1) { // in 1d Cjr are computed once for all diff --git a/src/scheme/FiniteVolumesDiffusion.hpp b/src/scheme/FiniteVolumesDiffusion.hpp index c47761df296c5562ae78a3870ae339fa47a959a3..f7c0517df6d652778b361c7d305213757cca8d60 100644 --- a/src/scheme/FiniteVolumesDiffusion.hpp +++ b/src/scheme/FiniteVolumesDiffusion.hpp @@ -81,11 +81,11 @@ private: const Kokkos::View<const unsigned int**>& cell_nodes = m_connectivity.cellNodes(); const Kokkos::View<const unsigned short*> cell_nb_nodes = m_connectivity.cellNbNodes(); - const Kokkos::View<const double*>& Dj = m_mesh_data.Dj(); + const Kokkos::View<const double*>& Vl = m_mesh_data.Vl(); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) { for (int r=0; r<cell_nb_nodes[j]; ++r) { - m_Fjr(j,r) = ((kj(cell_nodes(j,r)) + kj(cell_nodes(j-1,r)))/(2*Dj(j))) + m_Fjr(j,r) = ((kj(cell_nodes(j,r)) + kj(cell_nodes(j-1,r)))/(2*Vl(j))) * ((uj(j,r),Cjr(j,r))+ (uj(j-1,r),Cjr(j-1,r))) ; //tensorProduct(uj(j,r),Cjr(j,r)) ? } }); @@ -162,20 +162,25 @@ public: const Kokkos::View<const double*>& kj) const { Kokkos::View<double*> dt_j("dt_j", m_mesh.numberOfCells()); const Kokkos::View<const Rd**> Cjr = m_mesh_data.Cjr(); - const Kokkos::View<const double*>& Dj = m_mesh_data.Dj(); + const Kokkos::View<const double*>& Vl = m_mesh_data.Vl(); const Kokkos::View<const double*>& Vj = m_mesh_data.Vj(); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ - //dt_j[j]= 0.5*rhoj(j)*Vj(j)*(2./(kj(j+1) + 2*kj(j) + kj(j-1))) - // * std::min(Dj(j),Dj(j-1)); // ATTENTION : kj != 0 ! + dt_j[j]= 0.5*rhoj(j)*Vj(j)*(2./(kj(j+1) + 2*kj(j) + kj(j-1))) + * std::min(Vl(j),Vl(j-1)); // ATTENTION : kj != 0 ! // * std::min(xj(j+1)-xj(j), xj(j)-xj(j-1)); // * std::min((Dxj(j+1),Cjr(j,1)) + (xj(j),Cjr(j,0)), //(xj(j),Cjr(j,1)) + (xj(j-1),Cjr(j,0)) ); - dt_j[j] = 0.0001; + //dt_j[j] = 0.0001; + std::cout << Vl(j) << std::endl; + //std::cout << std::min(Dj(j),Dj(j-1)) << std::endl; + // Le probleme vient aussi de Dj }); + double dt = std::numeric_limits<double>::max(); Kokkos::parallel_reduce(m_mesh.numberOfCells(), ReduceMin(dt_j), dt); + //std::cout << dt << std::endl; return dt; } diff --git a/src/scheme/FiniteVolumesEulerUnknowns.hpp b/src/scheme/FiniteVolumesEulerUnknowns.hpp index 70ac380723b33a1d7ac6cef47455fba30756d196..787e16852fc29f80029486cdb9f4c8627c8d7287 100644 --- a/src/scheme/FiniteVolumesEulerUnknowns.hpp +++ b/src/scheme/FiniteVolumesEulerUnknowns.hpp @@ -173,7 +173,7 @@ public: }); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ - m_kj[j] = 0.1; // Par quoi initialiser k ? + m_kj[j] = 1; }); }