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

ajout nouveau maillage non uniforme

parent ebf90dc7
No related branches found
No related tags found
No related merge requests found
...@@ -196,7 +196,7 @@ int main(int argc, char *argv[]) ...@@ -196,7 +196,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("comparaison_u_k_non_cst_maill_non_unif_640"); std::ofstream fout("comparaison_u_k_non_cst_maill_non_unif_320");
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
fout << xj[j][0] << ' ' << uj[j][0] << ' ' << std::sin(pi*xj[j][0])*std::exp(-0.2) <<'\n'; // cas k non constant fout << xj[j][0] << ' ' << uj[j][0] << ' ' << std::sin(pi*xj[j][0])*std::exp(-0.2) <<'\n'; // cas k non constant
......
...@@ -62,36 +62,42 @@ public: ...@@ -62,36 +62,42 @@ public:
// pas non constant // pas non constant
//Mesh(const Connectivity& connectivity)
// : m_connectivity(connectivity),
// m_xr("xr", connectivity.numberOfNodes())
//{
// const double delta_x = 1./connectivity.numberOfCells();
// Kokkos::parallel_for(connectivity.numberOfNodes(), KOKKOS_LAMBDA(const int& r){
// if (r%2 == 0) {
// m_xr[r][0] = r*delta_x;
// }
// else {
// m_xr[r][0] = (r*2+1)*0.5*delta_x;
// }
// });
//}
// pas non constant avec fonction x^2
Mesh(const Connectivity& connectivity) Mesh(const Connectivity& connectivity)
: m_connectivity(connectivity), : m_connectivity(connectivity),
m_xr("xr", connectivity.numberOfNodes()) m_xr("xr", connectivity.numberOfNodes())
{ {
const double delta_x = 1./connectivity.numberOfCells(); const double delta_x = 1./connectivity.numberOfCells();
Kokkos::parallel_for(connectivity.numberOfNodes(), KOKKOS_LAMBDA(const int& r){ Kokkos::parallel_for(connectivity.numberOfNodes(), KOKKOS_LAMBDA(const int& r){
if (r%4 == 1) {
m_xr[r][0] = (r*2+1)*0.5*delta_x;
}
else {
if (r%4==3) {
m_xr[r][0] = ((r*3-1)/3.)*delta_x;
}
else
{
m_xr[r][0] = r*delta_x; m_xr[r][0] = r*delta_x;
}); }
Kokkos::parallel_for(connectivity.numberOfNodes(), KOKKOS_LAMBDA(const int& r){ }
m_xr[r][0] = m_xr[r][0]*m_xr[r][0];
}); });
} }
// pas non constant avec fonction x^2 (mauvais choix pas, hyper lent)
// Mesh(const Connectivity& connectivity)
// : m_connectivity(connectivity),
// m_xr("xr", connectivity.numberOfNodes())
//{
// const double delta_x = 1./connectivity.numberOfCells();
// Kokkos::parallel_for(connectivity.numberOfNodes(), KOKKOS_LAMBDA(const int& r){
// m_xr[r][0] = r*delta_x;
// });
// Kokkos::parallel_for(connectivity.numberOfNodes(), KOKKOS_LAMBDA(const int& r){
// m_xr[r][0] = m_xr[r][0]*m_xr[r][0];
// });
//}
~Mesh() ~Mesh()
{ {
; ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment