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

tentative d ecrire dans un fichier colonne par colonne

parent 36c559df
Branches
Tags
No related merge requests found
#include <iostream>
#include <fstream>
#include <iomanip>
#include <Kokkos_Core.hpp>
#include <RevisionInfo.hpp>
#include <rang.hpp>
#include <FPEManager.hpp>
#include <SignalManager.hpp>
#include <ConsoleManager.hpp>
#include <string>
// #include <RawKokkosAcousticSolver.hpp>
// #include <MeshLessAcousticSolver.hpp>
......@@ -138,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=1.5;
const double tmax=0.5;
double t=0;
int itermax=std::numeric_limits<int>::max();
......@@ -153,8 +156,16 @@ int main(int argc, char *argv[])
BlockPerfectGas block_eos(rhoj, ej, pj, gammaj, cj);
//double c = 0.;
//c = finite_volumes_diffusion.conservatif(unknowns);
double c = 0.;
c = finite_volumes_diffusion.conservatif(unknowns);
// Ecriture des valeurs initiales de rho dans un fichier
const Kokkos::View<const Rd*> xj = mesh_data.xj();
std::ofstream fout("film_rho", std::ios::trunc);
fout.precision(15);
for (size_t j=0; j<mesh.numberOfCells(); ++j) {
fout << std::fixed << xj[j][0] << ' ' << std::fixed << rhoj[j] << '\n';
}
while((t<tmax) and (iteration<itermax)) {
......@@ -187,7 +198,6 @@ int main(int argc, char *argv[])
}
}
// DIFFUSION PURE
/*
......@@ -203,8 +213,22 @@ int main(int argc, char *argv[])
++iteration;
std::cout << "temps t : " << t << std::endl;
// Ecriture des valeurs de rho par pas de temps dans le fichier
std::ofstream fout("film_rho", std::ios::app);
fout.precision(15);
fout.clear();
fout.seekp(0, std::ios::beg);
//int const position = 0;
for (size_t j=0; j<mesh.numberOfCells(); ++j) {
fout.seekp(35*iteration*j);
//position = fout.tellp();
//std::cout << "Nous sommes au " << fout.tellp() << "eme caractere du fichier" << std::endl;
fout << ' ' << std::fixed << rhoj[j] << '\n';
//std::cin.ignore(35*iteration, '\n');
}
}
std::cout << "* " << rang::style::underline << "Final time" << rang::style::reset
<< ": " << rang::fgB::green << t << rang::fg::reset << " (" << iteration << " iterations)\n";
......@@ -234,16 +258,16 @@ int main(int argc, char *argv[])
std::cout << "* " << rang::style::underline << "Erreur L2 E" << rang::style::reset
<< ": " << rang::fgB::green << error3 << rang::fg::reset << " \n";
*/
/*
std::cout << "* " << rang::style::underline << "Resultat conservativite rho E temps = 0" << rang::style::reset
<< ": " << rang::fgB::green << c << rang::fg::reset << " \n";
double cons = 0.;
cons = finite_volumes_diffusion.conservatif(unknowns);
std::cout << "* " << rang::style::underline << "Resultat conservativite E" << rang::style::reset
std::cout << "* " << rang::style::underline << "Resultat conservativite rho E" << rang::style::reset
<< ": " << rang::fgB::green << cons << rang::fg::reset << " \n";
*/
//method_cost_map["AcousticSolverWithMesh"] = timer.seconds();
method_cost_map["FiniteVolumesDiffusionWithMesh"] = timer.seconds();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment