Skip to content
Snippets Groups Projects
Commit f29a6992 authored by Fanny CHOPOT's avatar Fanny CHOPOT
Browse files

Corrections stephane dans diffusion_dt

parent efc24049
No related branches found
No related tags found
No related merge requests found
...@@ -84,7 +84,7 @@ private: ...@@ -84,7 +84,7 @@ private:
Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) { Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) {
for (int r=0; r<cell_nb_nodes[j]; ++r) { 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: ...@@ -93,14 +93,14 @@ private:
Kokkos::View<double**> // Fonction qui calcule G_jr Kokkos::View<double**> // Fonction qui calcule G_jr
computeGjr(const Kokkos::View<const Rd*>& uj, 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 int**>& cell_nodes = m_connectivity.cellNodes();
const Kokkos::View<const unsigned short*> cell_nb_nodes const Kokkos::View<const unsigned short*> cell_nb_nodes
= m_connectivity.cellNbNodes(); = m_connectivity.cellNbNodes();
Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) { Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) {
for (int r=0; r<cell_nb_nodes[j]; ++r) { 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: ...@@ -128,8 +128,7 @@ private:
// Enchaine les operations pour calculer les flux (Fjr et Gjr) pour // Enchaine les operations pour calculer les flux (Fjr et Gjr) pour
// pouvoir derouler le schema // pouvoir derouler le schema
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
void computeExplicitFluxes(const Kokkos::View<const Rd*>& xr, void computeExplicitFluxes(const Kokkos::View<const Rd*>& xj,
const Kokkos::View<const Rd*>& xj,
const Kokkos::View<const double*>& rhoj, const Kokkos::View<const double*>& rhoj,
const Kokkos::View<const Rd*>& uj, const Kokkos::View<const Rd*>& uj,
const Kokkos::View<const Rd**>& Cjr, const Kokkos::View<const Rd**>& Cjr,
...@@ -142,7 +141,6 @@ private: ...@@ -142,7 +141,6 @@ private:
Kokkos::View<Rd**> m_Fjr; Kokkos::View<Rd**> m_Fjr;
Kokkos::View<double**> m_Gjr; Kokkos::View<double**> m_Gjr;
Kokkos::View<double*> m_CFL;
public: public:
FiniteVolumesDiffusion(MeshData& mesh_data, FiniteVolumesDiffusion(MeshData& mesh_data,
...@@ -151,8 +149,7 @@ public: ...@@ -151,8 +149,7 @@ public:
m_mesh(mesh_data.mesh()), m_mesh(mesh_data.mesh()),
m_connectivity(m_mesh.connectivity()), m_connectivity(m_mesh.connectivity()),
m_Fjr("Fjr", m_mesh.numberOfCells(), m_connectivity.maxNbNodePerCell()), m_Fjr("Fjr", m_mesh.numberOfCells(), m_connectivity.maxNbNodePerCell()),
m_Gjr("Gjr", m_mesh.numberOfCells(), m_connectivity.maxNbNodePerCell()), m_Gjr("Gjr", m_mesh.numberOfCells(), m_connectivity.maxNbNodePerCell())
m_CFL("CFL", m_mesh.numberOfCells())
{ {
; ;
} }
...@@ -165,9 +162,14 @@ public: ...@@ -165,9 +162,14 @@ public:
const Kokkos::View<const double*>& kj) const { const Kokkos::View<const double*>& kj) const {
Kokkos::View<double*> dt_j("dt_j", m_mesh.numberOfCells()); 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*> 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){ 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(); double dt = std::numeric_limits<double>::max();
...@@ -192,17 +194,14 @@ public: ...@@ -192,17 +194,14 @@ public:
const Kokkos::View<const Rd*> xj = m_mesh_data.xj(); const Kokkos::View<const Rd*> xj = m_mesh_data.xj();
const Kokkos::View<const double*> Vj = m_mesh_data.Vj(); const Kokkos::View<const double*> Vj = m_mesh_data.Vj();
const Kokkos::View<const Rd**> Cjr = m_mesh_data.Cjr(); const Kokkos::View<const Rd**> Cjr = m_mesh_data.Cjr();
Kokkos::View<Rd*> xr = m_mesh.xr();
// Calcule les flux // 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 Rd**> Fjr = m_Fjr;
const Kokkos::View<const double**> Gjr = m_Gjr; const Kokkos::View<const double**> Gjr = m_Gjr;
const Kokkos::View<const unsigned short*> cell_nb_nodes const Kokkos::View<const unsigned short*> cell_nb_nodes
= m_connectivity.cellNbNodes(); = 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 // Mise a jour de la vitesse et de l'energie totale specifique
const Kokkos::View<const double*> inv_mj = unknowns.invMj(); const Kokkos::View<const double*> inv_mj = unknowns.invMj();
...@@ -210,7 +209,6 @@ public: ...@@ -210,7 +209,6 @@ public:
Rd momentum_fluxes = zero; Rd momentum_fluxes = zero;
double energy_fluxes = 0; double energy_fluxes = 0;
for (int R=0; R<cell_nb_nodes[j]; ++R) { for (int R=0; R<cell_nb_nodes[j]; ++R) {
const int r=cell_nodes(j,R);
momentum_fluxes += Fjr(j,R); momentum_fluxes += Fjr(j,R);
energy_fluxes += Gjr(j,R); energy_fluxes += Gjr(j,R);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment