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

modifs dans la boucle temps, moins d'oscillations

parent f51819fa
Branches
Tags
No related merge requests found
...@@ -172,10 +172,10 @@ int main(int argc, char *argv[]) ...@@ -172,10 +172,10 @@ int main(int argc, char *argv[])
if (dt_euler <= dt_diff) { if (dt_euler <= dt_diff) {
dt_diff = dt_euler; dt_diff = dt_euler;
finite_volumes_diffusion.computeNextStep(t, dt_diff, unknowns); finite_volumes_diffusion.computeNextStep(t, dt_diff, unknowns);
t += dt_euler; t += dt_diff;
} else { } else {
double t_diff = t + dt_diff; double t_diff = t;
while ((t + dt_euler > t_diff) and (t_diff < tmax)) { while (t + dt_euler > t_diff) {
finite_volumes_diffusion.computeNextStep(t_diff, dt_diff, unknowns); finite_volumes_diffusion.computeNextStep(t_diff, dt_diff, unknowns);
dt_diff = 0.4*finite_volumes_diffusion.diffusion_dt(rhoj, kj); dt_diff = 0.4*finite_volumes_diffusion.diffusion_dt(rhoj, kj);
t_diff += dt_diff; t_diff += dt_diff;
...@@ -230,9 +230,15 @@ int main(int argc, char *argv[]) ...@@ -230,9 +230,15 @@ int main(int argc, char *argv[])
double cons = 0.; double cons = 0.;
cons = finite_volumes_diffusion.conservatif(unknowns); cons = finite_volumes_diffusion.conservatif(unknowns);
std::cout << "* " << rang::style::underline << "Resultat conservativite" << rang::style::reset std::cout << "* " << rang::style::underline << "Resultat conservativite E" << rang::style::reset
<< ": " << rang::fgB::green << cons << rang::fg::reset << " \n"; << ": " << rang::fgB::green << cons << rang::fg::reset << " \n";
double cons1 = 0.;
cons1 = finite_volumes_diffusion.conservatif_mvt(unknowns);
std::cout << "* " << rang::style::underline << "Resultat conservativite rho u" << rang::style::reset
<< ": " << rang::fgB::green << cons1 << rang::fg::reset << " \n";
//method_cost_map["AcousticSolverWithMesh"] = timer.seconds(); //method_cost_map["AcousticSolverWithMesh"] = timer.seconds();
method_cost_map["FiniteVolumesDiffusionWithMesh"] = timer.seconds(); method_cost_map["FiniteVolumesDiffusionWithMesh"] = timer.seconds();
...@@ -240,7 +246,7 @@ int main(int argc, char *argv[]) ...@@ -240,7 +246,7 @@ int main(int argc, char *argv[])
{ // gnuplot output for density { // gnuplot output for density
const Kokkos::View<const Rd*> xj = mesh_data.xj(); const Kokkos::View<const Rd*> xj = mesh_data.xj();
const Kokkos::View<const Rd*> uj = unknowns.uj(); const Kokkos::View<const Rd*> uj = unknowns.uj();
std::ofstream fout("rho ns"); std::ofstream fout("rho nounif");
fout.precision(15); fout.precision(15);
for (size_t j=0; j<mesh.numberOfCells(); ++j) { for (size_t j=0; j<mesh.numberOfCells(); ++j) {
fout << xj[j][0] << ' ' << rhoj[j] << '\n'; fout << xj[j][0] << ' ' << rhoj[j] << '\n';
...@@ -251,7 +257,7 @@ int main(int argc, char *argv[]) ...@@ -251,7 +257,7 @@ int main(int argc, char *argv[])
const Kokkos::View<const Rd*> xj = mesh_data.xj(); const Kokkos::View<const Rd*> xj = mesh_data.xj();
const Kokkos::View<const Rd*> uj = unknowns.uj(); const Kokkos::View<const Rd*> uj = unknowns.uj();
//double pi = 4.*std::atan(1.); //double pi = 4.*std::atan(1.);
std::ofstream fout("u ns"); std::ofstream fout("u nounif");
fout.precision(15); fout.precision(15);
for (size_t j=0; j<mesh.numberOfCells(); ++j) { 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.2) <<'\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
...@@ -264,7 +270,7 @@ int main(int argc, char *argv[]) ...@@ -264,7 +270,7 @@ int main(int argc, char *argv[])
const Kokkos::View<const Rd*> xj = mesh_data.xj(); const Kokkos::View<const Rd*> xj = mesh_data.xj();
const Kokkos::View<const double*> Ej = unknowns.Ej(); const Kokkos::View<const double*> Ej = unknowns.Ej();
//double pi = 4.*std::atan(1.); //double pi = 4.*std::atan(1.);
std::ofstream fout("E ns"); std::ofstream fout("E nounif");
fout.precision(15); fout.precision(15);
for (size_t j=0; j<mesh.numberOfCells(); ++j) { for (size_t j=0; j<mesh.numberOfCells(); ++j) {
//fout << xj[j][0] << ' ' << Ej[j] << ' ' << (-(std::cos(pi*xj[j][0])*std::cos(pi*xj[j][0]))+(std::sin(pi*xj[j][0])*std::sin(pi*xj[j][0])))*0.5*(std::exp(-4.*pi*pi*0.2)-1.) + 2. <<'\n'; // cas k constant //fout << xj[j][0] << ' ' << Ej[j] << ' ' << (-(std::cos(pi*xj[j][0])*std::cos(pi*xj[j][0]))+(std::sin(pi*xj[j][0])*std::sin(pi*xj[j][0])))*0.5*(std::exp(-4.*pi*pi*0.2)-1.) + 2. <<'\n'; // cas k constant
......
...@@ -86,7 +86,6 @@ public: ...@@ -86,7 +86,6 @@ public:
}); });
} }
~Mesh() ~Mesh()
{ {
; ;
......
...@@ -416,6 +416,27 @@ public: ...@@ -416,6 +416,27 @@ public:
} }
// Verifie la conservativite de quantite de mvt
double conservatif_mvt(UnknownsType& unknowns) {
Kokkos::View<double*> rhoj = unknowns.rhoj();
Kokkos::View<Rd*> uj = unknowns.uj();
const Kokkos::View<const double*> Vj = m_mesh_data.Vj();
const Kokkos::View<const Rd*> xj = m_mesh_data.xj();
double sum = 0.;
for (size_t j=0; j<m_mesh.numberOfCells(); ++j) {
sum += Vj[j]*rhoj[j]*uj[j][0];
}
return sum;
}
}; };
#endif // FINITE_VOLUMES_DIFFUSION_HPP #endif // FINITE_VOLUMES_DIFFUSION_HPP
...@@ -232,15 +232,15 @@ public: ...@@ -232,15 +232,15 @@ public:
}); });
Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){
m_kj[j] = 0.0002*0.5; m_kj[j] = 1.;
}); });
// Conditions aux bords de Dirichlet sur u et k // Conditions aux bords de Dirichlet sur u et k
m_uL[0] = zero; m_uL[0] = zero;
m_uR[0] = zero; m_uR[0] = zero;
m_kL[0] = 0.0002*0.5; m_kL[0] = 1.;
m_kR[0] = 0.0002*0.5; m_kR[0] = 1.;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment