diff --git a/src/main.cpp b/src/main.cpp index 445acb0f50b9325c83b74b7734a8a1fcbfc2e8bd..786d2e3d4eec8bbe773dc884603aa5e9247e4582 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -164,6 +164,7 @@ int main(int argc, char *argv[]) // Ecriture des valeurs initiales dans un fichier const Kokkos::View<const Rd*> xj = mesh_data.xj(); + const Kokkos::View<const Rd*> xr = mesh.xr(); // rho std::ofstream fout1("inter1", std::ios::trunc); @@ -208,32 +209,33 @@ int main(int argc, char *argv[]) // 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'; + // en 1D : mesh.numberOfNodes() = mesh.numberOfCells() - 1 + for (size_t j=0; j<mesh.numberOfNodes()-2; ++j) { + fout6 << std::fixed << xj[j][0] << ' ' << std::fixed << (uj[j+1][0]-uj[j][0])/(xr[j+2][0]-xr[j+1][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'; + for (size_t j=0; j<mesh.numberOfNodes()-2; ++j) { + fout7 << std::fixed << xj[j][0] << ' ' << std::fixed << (pj[j+1]-pj[j])/(xr[j+2][0]-xr[j+1][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'; + for (size_t j=0; j<mesh.numberOfNodes()-2; ++j) { + fout8 << std::fixed << xj[j][0] << ' ' << std::fixed << (rhoj[j+1]-rhoj[j])/(xr[j+2][0]-xr[j+1][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'; + for (size_t j=0; j<mesh.numberOfNodes()-2; ++j) { + fout9 << std::fixed << xj[j][0] << ' ' << std::fixed << (((rhoj[j+1]-rhoj[j])/(xr[j+2][0]-xr[j+1][0]))*((pj[j+1]-pj[j])/(xr[j+2][0]-xr[j+1][0])))/(rhoj[j]*rhoj[j]) << '\n'; } fout9.close(); @@ -434,16 +436,16 @@ int main(int argc, char *argv[]) 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) { + for (size_t j = 0; j<mesh.numberOfNodes()-2; ++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'; + fout6 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << (uj[j+1][0]-uj[j][0])/(xr[j+2][0]-xr[j+1][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) { + for (size_t j = 0; j<mesh.numberOfNodes()-2; ++j) { getline(rint6, ligne); rout6 << ligne << '\n'; } @@ -454,16 +456,16 @@ int main(int argc, char *argv[]) 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) { + for (size_t j = 0; j<mesh.numberOfNodes()-2; ++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'; + fout7 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << (pj[j+1]-pj[j])/(xr[j+2][0]-xr[j+1][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) { + for (size_t j = 0; j<mesh.numberOfNodes()-2; ++j) { getline(rint7, ligne); rout7 << ligne << '\n'; } @@ -474,16 +476,16 @@ int main(int argc, char *argv[]) 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) { + for (size_t j = 0; j<mesh.numberOfNodes()-2; ++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'; + fout8 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << (rhoj[j+1]-rhoj[j])/(xr[j+2][0]-xr[j+1][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) { + for (size_t j = 0; j<mesh.numberOfNodes()-2; ++j) { getline(rint8, ligne); rout8 << ligne << '\n'; } @@ -494,16 +496,16 @@ int main(int argc, char *argv[]) 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) { + for (size_t j = 0; j<mesh.numberOfNodes()-2; ++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'; + fout9 << ligne << ' ' << std::fixed << xj[j][0] << ' ' << std::fixed << (((rhoj[j+1]-rhoj[j])/(xr[j+2][0]-xr[j+1][0]))*((pj[j+1]-pj[j])/(xr[j+2][0]-xr[j+1][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) { + for (size_t j = 0; j<mesh.numberOfNodes()-2; ++j) { getline(rint9, ligne); rout9 << ligne << '\n'; }