diff --git a/src/main.cpp b/src/main.cpp index 97bc4e94c2ef04d93b69ca28e79fb5dce2d45eb8..c8b6fe135b1a14a035f91d1e09287e205e990d1e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -141,7 +141,7 @@ int main(int argc, char *argv[]) const Kokkos::View<const double*> Vj = mesh_data.Vj(); const Kokkos::View<const Rd**> Cjr = mesh_data.Cjr(); - const double tmax=2.; + const double tmax=0.5; double t=0.; int itermax=std::numeric_limits<int>::max(); @@ -161,14 +161,20 @@ int main(int argc, char *argv[]) // Ecriture des valeurs initiales de rho dans un fichier const Kokkos::View<const Rd*> xj = mesh_data.xj(); - std::ofstream fout("inter"); + std::ofstream fout("inter", std::ios::trunc); fout.precision(15); - fout << std::fixed << 0. << ' ' << std::fixed << t << '\n'; + //fout << std::fixed << 0. << ' ' << std::fixed << t << '\n'; for (size_t j=0; j<mesh.numberOfCells(); ++j) { fout << std::fixed << xj[j][0] << ' ' << std::fixed << rhoj[j] << '\n'; } fout.close(); + // Fichier temps + std::ofstream tempo("temps"); + tempo.precision(5); + tempo << std::fixed << t << '\n'; + tempo.close(); + while((t<tmax) and (iteration<itermax)) { // ETAPE 1 DU SPLITTING - EULER @@ -224,8 +230,8 @@ int main(int argc, char *argv[]) //fout.clear(); //fout.seekp(0, std::ios::beg); std::string ligne; - getline(fint, ligne); - fout << ligne << ' ' << std::fixed << t << '\n'; + //getline(fint,ligne); + //fout << ligne << ' ' << std::fixed << t << '\n'; for (size_t j = 0; j<mesh.numberOfCells(); ++j) { getline(fint, ligne); fout << ligne << ' ' << std::fixed << rhoj[j] << '\n'; @@ -236,8 +242,8 @@ int main(int argc, char *argv[]) std::ifstream rint("film_rho"); std::ofstream rout("inter", std::ios::trunc); fout.precision(15); - getline(rint, ligne); - rout << ligne << '\n'; + //getline(rint, ligne); + //rout << ligne << '\n'; for (size_t j = 0; j<mesh.numberOfCells(); ++j) { getline(rint, ligne); rout << ligne << '\n'; @@ -245,6 +251,12 @@ int main(int argc, char *argv[]) rint.close(); rout.close(); + // Fichier temps + std::ofstream tempo("temps", std::ios::app); + tempo.precision(5); + tempo << std::fixed << t << '\n'; + tempo.close(); + } std::cout << "* " << rang::style::underline << "Final time" << rang::style::reset diff --git a/src/mesh/Mesh.hpp b/src/mesh/Mesh.hpp index 667f1877db466a9d581834099739504c9d78429b..51c7f7d0002356f12eeab8a2628446a7d4f92b1f 100644 --- a/src/mesh/Mesh.hpp +++ b/src/mesh/Mesh.hpp @@ -81,7 +81,7 @@ public: m_xmax("xmax", 1) { double a = 0.; - double b = 10.; + double b = 1.; m_x0[0][0] = a; m_xmax[0][0] = b; const double delta_x = (b-a)/connectivity.numberOfCells();