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

code plus propre

parent 14d7add0
No related branches found
No related tags found
No related merge requests found
......@@ -196,9 +196,9 @@ int main(int argc, char *argv[])
const Kokkos::View<const Rd*> xj = mesh_data.xj();
const Kokkos::View<const Rd*> uj = unknowns.uj();
double pi = 4.*std::atan(1.);
std::ofstream fout("comparaison u");
std::ofstream fout("comparaison_u_k_non_cst_maill_non_unif_640");
for (size_t j=0; j<mesh.numberOfCells(); ++j) {
//fout << xj[j][0] << ' ' << uj[j][0] << ' ' << std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.001) <<'\n'; //cas k constant
//fout << xj[j][0] << ' ' << uj[j][0] << ' ' << std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.2) <<'\n'; //cas k constant
fout << xj[j][0] << ' ' << uj[j][0] << ' ' << std::sin(pi*xj[j][0])*std::exp(-0.2) <<'\n'; // cas k non constant
}
}
......
......@@ -99,12 +99,7 @@ private:
sum2 += kj(cell_here);
}
// k = x
// m_Fl(l) = ((sum2*0.5)/Vl(l))*sum;
m_Fl(l) = ((sum2/face_nb_cells(l))/Vl(l))*sum;
// k = 2
//m_Fl(l)= (2./Vl(l))*sum;
});
......@@ -309,13 +304,15 @@ public:
const Kokkos::View<const Rd*> xj = m_mesh_data.xj();
const Kokkos::View<const double*> Vj = m_mesh_data.Vj();
double pi = 4.*std::atan(1.);
double erreur = 0.;
double exacte = 0.;
for (size_t j=0; j<m_mesh.numberOfCells(); ++j) {
//exacte = std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.001); // solution exacte cas test k constant
//exacte = std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.2); // solution exacte cas test k constant
exacte = std::sin(pi*xj[j][0])*std::exp(-0.2); // solution exacte cas test k non constant
erreur += (exacte - uj[j][0])*(exacte - uj[j][0]);
erreur += (exacte - uj[j][0])*(exacte - uj[j][0])*Vj(j);
}
erreur = std::sqrt(erreur);
return erreur;
......@@ -331,12 +328,12 @@ public:
const Kokkos::View<const Rd*> xj = m_mesh_data.xj();
double pi = 4.*std::atan(1.);
//double exacte = std::sin(pi*xj[0][0])*std::exp(-2.*pi*pi*0.001); // k constant
//double exacte = std::sin(pi*xj[0][0])*std::exp(-2.*pi*pi*0.2); // k constant
double exacte = std::sin(pi*xj[0][0])*std::exp(-0.2); // k non constant
double erreur = std::abs(exacte - uj[0][0]);
for (size_t j=1; j<m_mesh.numberOfCells(); ++j) {
//exacte = std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.001);
//exacte = std::sin(pi*xj[j][0])*std::exp(-2.*pi*pi*0.2);
exacte = std::sin(pi*xj[j][0])*std::exp(-0.2);
if (std::abs(exacte - uj[j][0]) > erreur) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment