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

version pour obtenir animations de rho u et e en même temps

parent a935e8ac
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <SignalManager.hpp> #include <SignalManager.hpp>
#include <ConsoleManager.hpp> #include <ConsoleManager.hpp>
#include <string> #include <string>
#include <cmath>
// #include <RawKokkosAcousticSolver.hpp> // #include <RawKokkosAcousticSolver.hpp>
// #include <MeshLessAcousticSolver.hpp> // #include <MeshLessAcousticSolver.hpp>
...@@ -159,22 +160,41 @@ int main(int argc, char *argv[]) ...@@ -159,22 +160,41 @@ int main(int argc, char *argv[])
double c = 0.; double c = 0.;
c = finite_volumes_diffusion.conservatif(unknowns); c = finite_volumes_diffusion.conservatif(unknowns);
/*
// Ecriture des valeurs initiales dans un fichier // Ecriture des valeurs initiales dans un fichier
const Kokkos::View<const Rd*> xj = mesh_data.xj(); const Kokkos::View<const Rd*> xj = mesh_data.xj();
std::ofstream fout("inter", std::ios::trunc);
fout.precision(15); // rho
std::ofstream fout1("inter1", std::ios::trunc);
fout1.precision(15);
for (size_t j=0; j<mesh.numberOfCells(); ++j) { for (size_t j=0; j<mesh.numberOfCells(); ++j) {
fout << std::fixed << xj[j][0] << ' ' << std::fixed << rhoj[j] << '\n'; fout1 << std::fixed << xj[j][0] << ' ' << std::fixed << rhoj[j] << '\n';
} }
fout.close(); fout1.close();
// u
std::ofstream fout2("inter2", std::ios::trunc);
fout2.precision(15);
for (size_t j=0; j<mesh.numberOfCells(); ++j) {
fout2 << std::fixed << xj[j][0] << ' ' << std::fixed << uj[j][0] << '\n';
}
fout2.close();
// e
std::ofstream fout3("inter3", std::ios::trunc);
fout3.precision(15);
for (size_t j=0; j<mesh.numberOfCells(); ++j) {
fout3 << std::fixed << xj[j][0] << ' ' << std::fixed << ej[j] << '\n';
}
fout3.close();
// Fichier temps // Fichier temps
std::ofstream tempo("temps"); std::ofstream tempo("temps");
tempo.precision(5); tempo.precision(5);
tempo << std::fixed << t << '\n'; tempo << std::fixed << t << '\n';
tempo.close(); tempo.close();
*/
while((t<tmax) and (iteration<itermax)) { while((t<tmax) and (iteration<itermax)) {
...@@ -243,37 +263,81 @@ int main(int argc, char *argv[]) ...@@ -243,37 +263,81 @@ int main(int argc, char *argv[])
std::cout << "temps t : " << t << std::endl; std::cout << "temps t : " << t << std::endl;
// ECRITURE DANS UN FICHIER // ECRITURE DANS UN FICHIER
/*
std::ifstream fint("inter"); if ((std::fmod(t,0.001) < 0.0001) or (t == tmax)) {
std::ofstream fout("film", std::ios::trunc);
fout.precision(15);
std::string ligne; std::string ligne;
// rho
std::ifstream fint1("inter1");
std::ofstream fout1("film1", std::ios::trunc);
fout1.precision(15);
for (size_t j = 0; j<mesh.numberOfCells(); ++j) { for (size_t j = 0; j<mesh.numberOfCells(); ++j) {
getline(fint, ligne); getline(fint1, ligne);
fout << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << rhoj[j] << '\n'; fout1 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << rhoj[j] << '\n';
} }
fint.close(); fint1.close();
fout.close(); fout1.close();
std::ifstream rint("film"); std::ifstream rint1("film1");
std::ofstream rout("inter", std::ios::trunc); std::ofstream rout1("inter1", std::ios::trunc);
fout.precision(15); for (size_t j = 0; j<mesh.numberOfCells(); ++j) {
getline(rint1, ligne);
rout1 << ligne << '\n';
}
rint1.close();
rout1.close();
// u
std::ifstream fint2("inter2");
std::ofstream fout2("film2", std::ios::trunc);
fout2.precision(15);
for (size_t j = 0; j<mesh.numberOfCells(); ++j) { for (size_t j = 0; j<mesh.numberOfCells(); ++j) {
getline(rint, ligne); getline(fint2, ligne);
rout << ligne << '\n'; fout2 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << uj[j][0] << '\n';
} }
rint.close(); fint2.close();
rout.close(); fout2.close();
std::ifstream rint2("film2");
std::ofstream rout2("inter2", std::ios::trunc);
for (size_t j = 0; j<mesh.numberOfCells(); ++j) {
getline(rint2, ligne);
rout2 << ligne << '\n';
}
rint2.close();
rout2.close();
// e
std::ifstream fint3("inter3");
std::ofstream fout3("film3", std::ios::trunc);
fout3.precision(15);
for (size_t j = 0; j<mesh.numberOfCells(); ++j) {
getline(fint3, ligne);
fout3 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << ej[j] << '\n';
}
fint3.close();
fout3.close();
std::ifstream rint3("film3");
std::ofstream rout3("inter3", std::ios::trunc);
for (size_t j = 0; j<mesh.numberOfCells(); ++j) {
getline(rint3, ligne);
rout3 << ligne << '\n';
}
rint3.close();
rout3.close();
// Fichier temps // Fichier temps
std::ofstream tempo("temps", std::ios::app); std::ofstream tempo("temps", std::ios::app);
tempo.precision(5); tempo.precision(5);
tempo << std::fixed << t << '\n'; tempo << std::fixed << t << '\n';
tempo.close(); tempo.close();
*/
}
// ENTROPY TEST // ENTROPY TEST
finite_volumes_diffusion.entropie(unknowns); //finite_volumes_diffusion.entropie(unknowns);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment