From e42d56d434b40b1695857ea6b6d66c31c81cd996 Mon Sep 17 00:00:00 2001 From: Fanny CHOPOT <fanny.chopot.ocre@cea.fr> Date: Thu, 26 Apr 2018 16:00:38 +0200 Subject: [PATCH] ajout fonction initialisation pour diffusion --- src/scheme/FiniteVolumesEulerUnknowns.hpp | 72 +++++++++++++++++++---- 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/src/scheme/FiniteVolumesEulerUnknowns.hpp b/src/scheme/FiniteVolumesEulerUnknowns.hpp index 787e16852..6d019c0c0 100644 --- a/src/scheme/FiniteVolumesEulerUnknowns.hpp +++ b/src/scheme/FiniteVolumesEulerUnknowns.hpp @@ -128,32 +128,81 @@ public: return m_kj; } - void initializeSod() + // --- Acoustic Solver --- + + // void initializeSod() + //{ + // const Kokkos::View<const Rd*> xj = m_mesh_data.xj(); + + // Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ + // if (xj[j][0]<0.5) { + // m_rhoj[j]=1; + // } else { + // m_rhoj[j]=0.125; + // } + // }); + + //Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ + // if (xj[j][0]<0.5) { + // m_pj[j]=1; + // } else { + // m_pj[j]=0.1; + // } + // }); + + //Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ + // m_uj[j] = zero; + // }); + + //Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ + // m_gammaj[j] = 1.4; + // }); + + //BlockPerfectGas block_eos(m_rhoj, m_ej, m_pj, m_gammaj, m_cj); + //block_eos.updateEandCFromRhoP(); + + //Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ + // m_Ej[j] = m_ej[j]+0.5*(m_uj[j],m_uj[j]); + // }); + + //const Kokkos::View<const double*> Vj = m_mesh_data.Vj(); + //Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ + // m_mj[j] = m_rhoj[j] * Vj[j]; + // }); + + //Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ + // m_inv_mj[j] = 1./m_mj[j]; + // }); + + //Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ + // m_kj[j] = 1; + // }); + //} + + // ------------------ + +void initializeSod() { const Kokkos::View<const Rd*> xj = m_mesh_data.xj(); + double pi = 4.*std::atan(1.); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ - if (xj[j][0]<0.5) { + m_rhoj[j]=1; - } else { - m_rhoj[j]=0.125; - } + }); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ - if (xj[j][0]<0.5) { m_pj[j]=1; - } else { - m_pj[j]=0.1; - } + }); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ - m_uj[j] = zero; + m_uj[j] = std::sin(pi*xj[j][0]); }); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ - m_gammaj[j] = 1.4; + m_gammaj[j] = 2.; }); BlockPerfectGas block_eos(m_rhoj, m_ej, m_pj, m_gammaj, m_cj); @@ -177,6 +226,7 @@ public: }); } + FiniteVolumesEulerUnknowns(const MeshDataType& mesh_data) : m_mesh_data(mesh_data), m_mesh(m_mesh_data.mesh()), -- GitLab