diff --git a/src/scheme/FiniteVolumesDiffusion.hpp b/src/scheme/FiniteVolumesDiffusion.hpp index 5c28519fc276611d00a59dc5cddcaf8b51b8ace3..1b7e98f415284155a35d0c52d5b1014c24baa3aa 100644 --- a/src/scheme/FiniteVolumesDiffusion.hpp +++ b/src/scheme/FiniteVolumesDiffusion.hpp @@ -84,7 +84,7 @@ private: 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,r)-1))/(2*(xj(cell_nodes(j,r))-xj(cell_nodes(j,r)-1))))*uj(j,r)*Cjr(j,r); + m_Fjr(j,r) = ((kj(cell_nodes(j,r)) + kj(cell_nodes(j,r)-1))/(2*(xj(cell_nodes(j,r))-xj(cell_nodes(j,r)-1)))) * (uj(j,r),Cjr(j,r)); //tensorProduct(uj(j,r),Cjr(j,r)) ? } }); @@ -93,14 +93,14 @@ private: Kokkos::View<double**> // Fonction qui calcule G_jr computeGjr(const Kokkos::View<const Rd*>& uj, - const Kokkos::View<const double*>& Fjr) { + const Kokkos::View<const Rd**>& Fjr) { const Kokkos::View<const unsigned int**>& cell_nodes = m_connectivity.cellNodes(); const Kokkos::View<const unsigned short*> cell_nb_nodes = m_connectivity.cellNbNodes(); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) { for (int r=0; r<cell_nb_nodes[j]; ++r) { - m_Gjr(j,r) = (uj(cell_nodes(j,r)) + uj(cell_nodes(j,r)-1))*0.5*Fjr(j,r); + m_Gjr(j,r) = 0.5*(uj(cell_nodes(j,r)) + uj(cell_nodes(j,r)-1))*Fjr(j,r); } }); @@ -128,8 +128,7 @@ private: // Enchaine les operations pour calculer les flux (Fjr et Gjr) pour // pouvoir derouler le schema KOKKOS_INLINE_FUNCTION - void computeExplicitFluxes(const Kokkos::View<const Rd*>& xr, - const Kokkos::View<const Rd*>& xj, + void computeExplicitFluxes(const Kokkos::View<const Rd*>& xj, const Kokkos::View<const double*>& rhoj, const Kokkos::View<const Rd*>& uj, const Kokkos::View<const Rd**>& Cjr, @@ -142,7 +141,6 @@ private: Kokkos::View<Rd**> m_Fjr; Kokkos::View<double**> m_Gjr; - Kokkos::View<double*> m_CFL; public: FiniteVolumesDiffusion(MeshData& mesh_data, @@ -151,8 +149,7 @@ public: m_mesh(mesh_data.mesh()), m_connectivity(m_mesh.connectivity()), m_Fjr("Fjr", m_mesh.numberOfCells(), m_connectivity.maxNbNodePerCell()), - m_Gjr("Gjr", m_mesh.numberOfCells(), m_connectivity.maxNbNodePerCell()), - m_CFL("CFL", m_mesh.numberOfCells()) + m_Gjr("Gjr", m_mesh.numberOfCells(), m_connectivity.maxNbNodePerCell()) { ; } @@ -165,9 +162,14 @@ public: const Kokkos::View<const double*>& kj) const { Kokkos::View<double*> dt_j("dt_j", m_mesh.numberOfCells()); const Kokkos::View<const Rd*> xj = m_mesh_data.xj(); + const Kokkos::View<const Rd**> Cjr = m_mesh_data.Cjr(); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ - m_CFL(j) = rhoj(j)*Vj(j)*std::min(xj(j+1)-xj(j), xj(j)-xj(j-1))*(2./(kj(j+1) + 2*kj(j) + kj(j-1))); + dt_j[j] + = rhoj(j)*Vj(j)*(2./(kj(j+1) + 2*kj(j) + kj(j-1))) + // * std::min(xj(j+1)-xj(j), xj(j)-xj(j-1)); + * std::min((xj(j+1),Cjr(j,1)) + (xj(j),Cjr(j,0)), + (xj(j),Cjr(j,1)) + (xj(j-1),Cjr(j,0)) ); }); double dt = std::numeric_limits<double>::max(); @@ -192,17 +194,14 @@ public: const Kokkos::View<const Rd*> xj = m_mesh_data.xj(); const Kokkos::View<const double*> Vj = m_mesh_data.Vj(); const Kokkos::View<const Rd**> Cjr = m_mesh_data.Cjr(); - Kokkos::View<Rd*> xr = m_mesh.xr(); // Calcule les flux - computeExplicitFluxes(xr, xj, rhoj, uj, Cjr,kj); + computeExplicitFluxes(xj, rhoj, uj, Cjr, kj); const Kokkos::View<const Rd**> Fjr = m_Fjr; const Kokkos::View<const double**> Gjr = m_Gjr; const Kokkos::View<const unsigned short*> cell_nb_nodes = m_connectivity.cellNbNodes(); - const Kokkos::View<const unsigned int**>& cell_nodes - = m_connectivity.cellNodes(); // Mise a jour de la vitesse et de l'energie totale specifique const Kokkos::View<const double*> inv_mj = unknowns.invMj(); @@ -210,7 +209,6 @@ public: Rd momentum_fluxes = zero; double energy_fluxes = 0; for (int R=0; R<cell_nb_nodes[j]; ++R) { - const int r=cell_nodes(j,R); momentum_fluxes += Fjr(j,R); energy_fluxes += Gjr(j,R); }