From a1d1268c0d5e15b49d6b9d27ee4f7aa9a3f9ea5e Mon Sep 17 00:00:00 2001 From: Fanny CHOPOT <fanny.chopot.ocre@cea.fr> Date: Mon, 11 Jun 2018 11:37:42 +0200 Subject: [PATCH] ajout variables post traitements pour films --- src/main.cpp | 194 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 181 insertions(+), 13 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0ddfea5ad..445acb0f5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -142,7 +142,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=0.7; + const double tmax=0.8; double t=0.; int itermax=std::numeric_limits<int>::max(); @@ -189,6 +189,54 @@ int main(int argc, char *argv[]) } fout3.close(); + // p + std::ofstream fout4("inter4", std::ios::trunc); + fout4.precision(15); + for (size_t j=0; j<mesh.numberOfCells(); ++j) { + fout4 << std::fixed << xj[j][0] << ' ' << std::fixed << pj[j] << '\n'; + } + fout4.close(); + + // S + std::ofstream fout5("inter5", std::ios::trunc); + fout5.precision(15); + for (size_t j=0; j<mesh.numberOfCells(); ++j) { + fout5 << std::fixed << xj[j][0] << ' ' << std::fixed << std::log(pj[j]*std::pow(rhoj[j],-gammaj[j])) << '\n'; + } + fout5.close(); + + // derivee de u + std::ofstream fout6("inter6", std::ios::trunc); + fout6.precision(15); + for (size_t j=0; j<mesh.numberOfCells()-1; ++j) { + fout6 << std::fixed << xj[j][0] << ' ' << std::fixed << (uj[j+1][0]-uj[j][0])/(xj[j+1][0]-xj[j][0]) << '\n'; + } + fout6.close(); + + // derivee de p + std::ofstream fout7("inter7", std::ios::trunc); + fout7.precision(15); + for (size_t j=0; j<mesh.numberOfCells()-1; ++j) { + fout7 << std::fixed << xj[j][0] << ' ' << std::fixed << (pj[j+1]-pj[j])/(xj[j+1][0]-xj[j][0]) << '\n'; + } + fout7.close(); + + // derivee de rho + std::ofstream fout8("inter8", std::ios::trunc); + fout8.precision(15); + for (size_t j=0; j<mesh.numberOfCells()-1; ++j) { + fout8 << std::fixed << xj[j][0] << ' ' << std::fixed << (rhoj[j+1]-rhoj[j])/(xj[j+1][0]-xj[j][0]) << '\n'; + } + fout8.close(); + + // terme baroclyne + std::ofstream fout9("inter9", std::ios::trunc); + fout9.precision(15); + for (size_t j=0; j<mesh.numberOfCells()-1; ++j) { + fout9 << std::fixed << xj[j][0] << ' ' << std::fixed << (((rhoj[j+1]-rhoj[j])/(xj[j+1][0]-xj[j][0]))*((pj[j+1]-pj[j])/(xj[j+1][0]-xj[j][0])))/(rhoj[j]*rhoj[j]) << '\n'; + } + fout9.close(); + // Fichier temps std::ofstream tempo("temps"); tempo.precision(5); @@ -203,7 +251,7 @@ int main(int argc, char *argv[]) if (kj[j]>0.) { diff << std::fixed << xj[j][0] << ' ' << std::fixed << 4. << '\n'; } else { - diff << std::fixed << xj[j][0] << ' ' << std::fixed << 0. << '\n'; + diff << std::fixed << xj[j][0] << ' ' << std::fixed << -0.1 << '\n'; } } diff.close(); @@ -275,15 +323,16 @@ int main(int argc, char *argv[]) ++iteration; std::cout << "temps t : " << t << std::endl; + // ECRITURE DANS UN FICHIER - //if ((std::fmod(t,0.001) < 0.0001) or (t == tmax)) { + if ((std::fmod(t,0.001) < 0.0001) or (t == tmax)) { std::string ligne; // rho std::ifstream fint1("inter1"); - std::ofstream fout1("film1", std::ios::trunc); + std::ofstream fout1("film_rho", std::ios::trunc); fout1.precision(15); for (size_t j = 0; j<mesh.numberOfCells(); ++j) { getline(fint1, ligne); @@ -292,7 +341,7 @@ int main(int argc, char *argv[]) fint1.close(); fout1.close(); - std::ifstream rint1("film1"); + std::ifstream rint1("film_rho"); std::ofstream rout1("inter1", std::ios::trunc); for (size_t j = 0; j<mesh.numberOfCells(); ++j) { getline(rint1, ligne); @@ -303,7 +352,7 @@ int main(int argc, char *argv[]) // u std::ifstream fint2("inter2"); - std::ofstream fout2("film2", std::ios::trunc); + std::ofstream fout2("film_u", std::ios::trunc); fout2.precision(15); for (size_t j = 0; j<mesh.numberOfCells(); ++j) { getline(fint2, ligne); @@ -312,7 +361,7 @@ int main(int argc, char *argv[]) fint2.close(); fout2.close(); - std::ifstream rint2("film2"); + std::ifstream rint2("film_u"); std::ofstream rout2("inter2", std::ios::trunc); for (size_t j = 0; j<mesh.numberOfCells(); ++j) { getline(rint2, ligne); @@ -323,7 +372,7 @@ int main(int argc, char *argv[]) // e std::ifstream fint3("inter3"); - std::ofstream fout3("film3", std::ios::trunc); + std::ofstream fout3("film_e", std::ios::trunc); fout3.precision(15); for (size_t j = 0; j<mesh.numberOfCells(); ++j) { getline(fint3, ligne); @@ -332,7 +381,7 @@ int main(int argc, char *argv[]) fint3.close(); fout3.close(); - std::ifstream rint3("film3"); + std::ifstream rint3("film_e"); std::ofstream rout3("inter3", std::ios::trunc); for (size_t j = 0; j<mesh.numberOfCells(); ++j) { getline(rint3, ligne); @@ -340,6 +389,126 @@ int main(int argc, char *argv[]) } rint3.close(); rout3.close(); + + // p + std::ifstream fint4("inter4"); + std::ofstream fout4("film_p", std::ios::trunc); + fout4.precision(15); + for (size_t j = 0; j<mesh.numberOfCells(); ++j) { + getline(fint4, ligne); + fout4 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << pj[j] << '\n'; + } + fint4.close(); + fout4.close(); + + std::ifstream rint4("film_p"); + std::ofstream rout4("inter4", std::ios::trunc); + for (size_t j = 0; j<mesh.numberOfCells(); ++j) { + getline(rint4, ligne); + rout4 << ligne << '\n'; + } + rint4.close(); + rout4.close(); + + // S + std::ifstream fint5("inter5"); + std::ofstream fout5("film_S", std::ios::trunc); + fout5.precision(15); + for (size_t j = 0; j<mesh.numberOfCells(); ++j) { + getline(fint5, ligne); + fout5 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << std::log(pj[j]*std::pow(rhoj[j],-gammaj[j])) << '\n'; + } + fint5.close(); + fout5.close(); + + std::ifstream rint5("film_S"); + std::ofstream rout5("inter5", std::ios::trunc); + for (size_t j = 0; j<mesh.numberOfCells(); ++j) { + getline(rint5, ligne); + rout5 << ligne << '\n'; + } + rint5.close(); + rout5.close(); + + // derivee de u + std::ifstream fint6("inter6"); + std::ofstream fout6("film_du", std::ios::trunc); + fout6.precision(15); + for (size_t j = 0; j<mesh.numberOfCells()-1; ++j) { + getline(fint6, ligne); + fout6 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << (uj[j+1][0]-uj[j][0])/(xj[j+1][0]-xj[j][0]) << '\n'; + } + fint6.close(); + fout6.close(); + + std::ifstream rint6("film_du"); + std::ofstream rout6("inter6", std::ios::trunc); + for (size_t j = 0; j<mesh.numberOfCells()-1; ++j) { + getline(rint6, ligne); + rout6 << ligne << '\n'; + } + rint6.close(); + rout6.close(); + + // derivee de p + std::ifstream fint7("inter7"); + std::ofstream fout7("film_dp", std::ios::trunc); + fout7.precision(15); + for (size_t j = 0; j<mesh.numberOfCells()-1; ++j) { + getline(fint7, ligne); + fout7 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << (pj[j+1]-pj[j])/(xj[j+1][0]-xj[j][0]) << '\n'; + } + fint7.close(); + fout7.close(); + + std::ifstream rint7("film_dp"); + std::ofstream rout7("inter7", std::ios::trunc); + for (size_t j = 0; j<mesh.numberOfCells()-1; ++j) { + getline(rint7, ligne); + rout7 << ligne << '\n'; + } + rint7.close(); + rout7.close(); + + // derivee de rho + std::ifstream fint8("inter8"); + std::ofstream fout8("film_drho", std::ios::trunc); + fout8.precision(15); + for (size_t j = 0; j<mesh.numberOfCells()-1; ++j) { + getline(fint8, ligne); + fout8 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << (rhoj[j+1]-rhoj[j])/(xj[j+1][0]-xj[j][0]) << '\n'; + } + fint8.close(); + fout8.close(); + + std::ifstream rint8("film_drho"); + std::ofstream rout8("inter8", std::ios::trunc); + for (size_t j = 0; j<mesh.numberOfCells()-1; ++j) { + getline(rint8, ligne); + rout8 << ligne << '\n'; + } + rint8.close(); + rout8.close(); + + // terme baroclyne + std::ifstream fint9("inter9"); + std::ofstream fout9("film_baro", std::ios::trunc); + fout9.precision(15); + for (size_t j = 0; j<mesh.numberOfCells()-1; ++j) { + getline(fint9, ligne); + fout9 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << (((rhoj[j+1]-rhoj[j])/(xj[j+1][0]-xj[j][0]))*((pj[j+1]-pj[j])/(xj[j+1][0]-xj[j][0])))/(rhoj[j]*rhoj[j])<< '\n'; + } + fint9.close(); + fout9.close(); + + std::ifstream rint9("film_baro"); + std::ofstream rout9("inter9", std::ios::trunc); + for (size_t j = 0; j<mesh.numberOfCells()-1; ++j) { + getline(rint9, ligne); + rout9 << ligne << '\n'; + } + rint9.close(); + rout9.close(); // Fichier temps std::ofstream tempo("temps", std::ios::app); @@ -347,8 +516,7 @@ int main(int argc, char *argv[]) tempo << std::fixed << t << '\n'; tempo.close(); - // k - + // Fichier k indicateur std::ifstream diffint("diffinter"); std::ofstream diffout("k", std::ios::trunc); diffout.precision(5); @@ -358,7 +526,7 @@ int main(int argc, char *argv[]) if (kj[j]>0.) { diffout << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << 4. << '\n'; } else { - diffout << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << 0. << '\n'; + diffout << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << -0.1 << '\n'; } } diffint.close(); @@ -373,7 +541,7 @@ int main(int argc, char *argv[]) riffint.close(); riffout.close(); - //} + } // ENTROPY TEST //finite_volumes_diffusion.entropie(unknowns); -- GitLab