diff --git a/src/main.cpp b/src/main.cpp index 9d4682375c52ba917d97f40bf2e797e4c32c5058..b6c3216bc619e736d9bf51be36e1622f211655b3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -192,16 +192,16 @@ int main(int argc, char *argv[]) //method_cost_map["AcousticSolverWithMesh"] = timer.seconds(); method_cost_map["FiniteVolumesDiffusionWithMesh"] = timer.seconds(); - { // gnuplot output for density - const Kokkos::View<const Rd*> xj = mesh_data.xj(); - const Kokkos::View<const Rd*> uj = unknowns.uj(); - double pi = 4.*std::atan(1.); - std::ofstream fout("comparaison u"); - for (size_t j=0; j<mesh.numberOfCells(); ++j) { - //fout << xj[j][0] << ' ' << uj[j][0] << ' ' << std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.001) <<'\n'; //cas k constant - fout << xj[j][0] << ' ' << uj[j][0] << ' ' << std::sin(pi*xj[j][0])*std::exp(-0.2) <<'\n'; // cas k non constant - } - } + { // gnuplot output for density + const Kokkos::View<const Rd*> xj = mesh_data.xj(); + const Kokkos::View<const Rd*> uj = unknowns.uj(); + double pi = 4.*std::atan(1.); + std::ofstream fout("comparaison_u_k_non_cst_maill_non_unif_640"); + for (size_t j=0; j<mesh.numberOfCells(); ++j) { + //fout << xj[j][0] << ' ' << uj[j][0] << ' ' << std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.2) <<'\n'; //cas k constant + fout << xj[j][0] << ' ' << uj[j][0] << ' ' << std::sin(pi*xj[j][0])*std::exp(-0.2) <<'\n'; // cas k non constant + } + } } diff --git a/src/mesh/Mesh.hpp b/src/mesh/Mesh.hpp index b2a8c9b102df7fc9320134c9b0ce70ad89f33caa..a1d12a0abb659c57d663e023b0ffddc530551a2e 100644 --- a/src/mesh/Mesh.hpp +++ b/src/mesh/Mesh.hpp @@ -51,13 +51,13 @@ public: // pas constant // Mesh(const Connectivity& connectivity) - //: m_connectivity(connectivity), - // m_xr("xr", connectivity.numberOfNodes()) + // : m_connectivity(connectivity), + // m_xr("xr", connectivity.numberOfNodes()) //{ // const double delta_x = 1./connectivity.numberOfCells(); // Kokkos::parallel_for(connectivity.numberOfNodes(), KOKKOS_LAMBDA(const int& r){ // m_xr[r][0] = r*delta_x; - // }); + // }); //} // pas non constant @@ -79,17 +79,17 @@ public: // pas non constant avec fonction x^2 - Mesh(const Connectivity& connectivity) - : m_connectivity(connectivity), - m_xr("xr", connectivity.numberOfNodes()) + Mesh(const Connectivity& connectivity) + : m_connectivity(connectivity), + m_xr("xr", connectivity.numberOfNodes()) { const double delta_x = 1./connectivity.numberOfCells(); Kokkos::parallel_for(connectivity.numberOfNodes(), KOKKOS_LAMBDA(const int& r){ - m_xr[r][0] = r*delta_x; + m_xr[r][0] = r*delta_x; }); Kokkos::parallel_for(connectivity.numberOfNodes(), KOKKOS_LAMBDA(const int& r){ - m_xr[r][0] = m_xr[r][0]*m_xr[r][0]; - }); + m_xr[r][0] = m_xr[r][0]*m_xr[r][0]; + }); } ~Mesh() diff --git a/src/scheme/FiniteVolumesDiffusion.hpp b/src/scheme/FiniteVolumesDiffusion.hpp index 789dfa04eb99ca4739c28ac689cf31a938d4b058..c01f1883c6bc98a86a6b5973d5d1036667844ab3 100644 --- a/src/scheme/FiniteVolumesDiffusion.hpp +++ b/src/scheme/FiniteVolumesDiffusion.hpp @@ -99,12 +99,7 @@ private: sum2 += kj(cell_here); } - // k = x - // m_Fl(l) = ((sum2*0.5)/Vl(l))*sum; m_Fl(l) = ((sum2/face_nb_cells(l))/Vl(l))*sum; - // k = 2 - - //m_Fl(l)= (2./Vl(l))*sum; }); @@ -309,13 +304,15 @@ public: const Kokkos::View<const Rd*> xj = m_mesh_data.xj(); + const Kokkos::View<const double*> Vj = m_mesh_data.Vj(); + double pi = 4.*std::atan(1.); double erreur = 0.; double exacte = 0.; for (size_t j=0; j<m_mesh.numberOfCells(); ++j) { - //exacte = std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.001); // solution exacte cas test k constant + //exacte = std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.2); // solution exacte cas test k constant exacte = std::sin(pi*xj[j][0])*std::exp(-0.2); // solution exacte cas test k non constant - erreur += (exacte - uj[j][0])*(exacte - uj[j][0]); + erreur += (exacte - uj[j][0])*(exacte - uj[j][0])*Vj(j); } erreur = std::sqrt(erreur); return erreur; @@ -331,12 +328,12 @@ public: const Kokkos::View<const Rd*> xj = m_mesh_data.xj(); double pi = 4.*std::atan(1.); - //double exacte = std::sin(pi*xj[0][0])*std::exp(-2.*pi*pi*0.001); // k constant + //double exacte = std::sin(pi*xj[0][0])*std::exp(-2.*pi*pi*0.2); // k constant double exacte = std::sin(pi*xj[0][0])*std::exp(-0.2); // k non constant double erreur = std::abs(exacte - uj[0][0]); for (size_t j=1; j<m_mesh.numberOfCells(); ++j) { - //exacte = std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.001); + //exacte = std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.2); exacte = std::sin(pi*xj[j][0])*std::exp(-0.2); if (std::abs(exacte - uj[j][0]) > erreur) {