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

correction des approximations de u et k

parent 5b7ea25d
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
// pas constant // pas constant
/*
Mesh(const Connectivity& connectivity) Mesh(const Connectivity& connectivity)
: m_connectivity(connectivity), : m_connectivity(connectivity),
m_xr("xr", connectivity.numberOfNodes()) m_xr("xr", connectivity.numberOfNodes())
...@@ -60,11 +60,11 @@ public: ...@@ -60,11 +60,11 @@ public:
m_xr[r][0] = r*delta_x; m_xr[r][0] = r*delta_x;
}); });
} }
*/
// pas non constant // pas non constant
/*
Mesh(const Connectivity& connectivity) Mesh(const Connectivity& connectivity)
: m_connectivity(connectivity), : m_connectivity(connectivity),
m_xr("xr", connectivity.numberOfNodes()) m_xr("xr", connectivity.numberOfNodes())
...@@ -85,7 +85,7 @@ public: ...@@ -85,7 +85,7 @@ public:
} }
}); });
} }
*/
~Mesh() ~Mesh()
{ {
......
...@@ -92,32 +92,38 @@ private: ...@@ -92,32 +92,38 @@ private:
= m_mesh.connectivity().faceCellLocalFace(); = m_mesh.connectivity().faceCellLocalFace();
const Kokkos::View<const double*>& Vl = m_mesh_data.Vl(); const Kokkos::View<const double*>& Vl = m_mesh_data.Vl();
const Kokkos::View<const double*>& Vj = m_mesh_data.Vj();
Kokkos::parallel_for(m_mesh.numberOfFaces(), KOKKOS_LAMBDA(const int& l) { Kokkos::parallel_for(m_mesh.numberOfFaces(), KOKKOS_LAMBDA(const int& l) {
Rdd sum = zero; Rdd sum = zero;
double sum2 = 0.; double sum2 = 0.;
double sum3 = 0.;
for (int j=0; j<face_nb_cells(l); ++j) { for (int j=0; j<face_nb_cells(l); ++j) {
int cell_here = face_cells(l,j); int cell_here = face_cells(l,j);
int local_face_number_in_cell = face_cell_local_face(l,j); int local_face_number_in_cell = face_cell_local_face(l,j);
sum -= tensorProduct(uj(cell_here), Cjr(cell_here, local_face_number_in_cell)); sum -= tensorProduct(uj(cell_here), Cjr(cell_here, local_face_number_in_cell));
sum2 += kj(cell_here); sum2 += kj(cell_here)*Vj(cell_here);
sum3 += Vj(cell_here);
} }
m_Fl(l) = ((sum2/face_nb_cells(l))/Vl(l))*sum; //m_Fl(l) = ((sum2/face_nb_cells(l))/Vl(l))*sum;
m_Fl(l) = ((sum2/sum3)/Vl(l))*sum;
// Conditions aux bords // Conditions aux bords
/*
// Essai 1
int cell_here = face_cells(0,0); int cell_here = face_cells(0,0);
int local_face_number_in_cell = face_cell_local_face(0,0); int local_face_number_in_cell = face_cell_local_face(0,0);
//m_Fl(0) = -(kL(0) + kj(cell_here))*0.5*(tensorProduct(uj(cell_here), Cjr(cell_here, local_face_number_in_cell)) - tensorProduct(uL(0), Cjr(cell_here, local_face_number_in_cell))); m_Fl(0) = -(kL(0) + kj(cell_here))*0.5*(tensorProduct(uj(cell_here), Cjr(cell_here, local_face_number_in_cell)) - tensorProduct(uL(0), Cjr(cell_here, local_face_number_in_cell)));
m_Fl(0) = -(kL(0) + kj(0))*0.5*(tensorProduct(uj(0), Cjr(0, 0)));
cell_here = face_cells(m_mesh.numberOfFaces()-1,0); cell_here = face_cells(m_mesh.numberOfFaces()-1,0);
local_face_number_in_cell = face_cell_local_face(m_mesh.numberOfFaces()-1,0); local_face_number_in_cell = face_cell_local_face(m_mesh.numberOfFaces()-1,0);
//m_Fl(m_mesh.numberOfFaces()-1) = -(kR(0) + kj(cell_here))*0.5*(tensorProduct(uj(cell_here), Cjr(cell_here, local_face_number_in_cell)) - tensorProduct(uR(0), Cjr(cell_here, local_face_number_in_cell))); m_Fl(m_mesh.numberOfFaces()-1) = -(kR(0) + kj(cell_here))*0.5*(tensorProduct(uj(cell_here), Cjr(cell_here, local_face_number_in_cell)) - tensorProduct(uR(0), Cjr(cell_here, local_face_number_in_cell)));
m_Fl(m_mesh.numberOfFaces()-1) = -(kR(0) + kj(m_mesh.numberOfCells()-1))*0.5*(tensorProduct(uj(m_mesh.numberOfCells()-1), Cjr(m_mesh.numberOfCells()-1,1)));
// Essai 2
m_Fl(0) = -(kL(0) + kj(0))*0.5*(tensorProduct(uj(0), Cjr(0, 0)));
m_Fl(m_mesh.numberOfFaces()-1) = -(kR(0) + kj(m_mesh.numberOfCells()-1))*0.5*(tensorProduct(uj(m_mesh.numberOfCells()-1), Cjr(m_mesh.numberOfCells()-1,1)));
*/
}); });
...@@ -137,21 +143,24 @@ private: ...@@ -137,21 +143,24 @@ private:
const Kokkos::View<const unsigned short**> face_cell_local_face const Kokkos::View<const unsigned short**> face_cell_local_face
= m_mesh.connectivity().faceCellLocalFace(); = m_mesh.connectivity().faceCellLocalFace();
const Kokkos::View<const double*>& Vj = m_mesh_data.Vj();
Kokkos::parallel_for(m_mesh.numberOfFaces(), KOKKOS_LAMBDA(const int& l) { Kokkos::parallel_for(m_mesh.numberOfFaces(), KOKKOS_LAMBDA(const int& l) {
Rd sum = zero; Rd sum = zero;
double sum2 = 0.;
for (int j=0; j<face_nb_cells(l); ++j) { for (int j=0; j<face_nb_cells(l); ++j) {
int cell_here = face_cells(l,j); int cell_here = face_cells(l,j);
sum += uj(cell_here); sum += Vj(cell_here)*uj(cell_here);
sum2 += Vj(cell_here);
} }
m_Gl(l) = (1./face_nb_cells(l))*Fl(l)*sum; //m_Gl(l) = (1./face_nb_cells(l))*Fl(l)*sum;
m_Gl(l) = (1./sum2)*Fl(l)*sum;
}); });
// C'est juste un test, mais ca devrait marcher // Provisoire
m_Gl(0) = 0; m_Gl(0) = 0;
m_Gl(m_mesh.numberOfFaces()-1) = 0; m_Gl(m_mesh.numberOfFaces()-1) = 0;
// m_Gl(0) = 0.5*m_Gl(0);
// m_Gl(m_mesh.numberOfFaces()-1) = 0.5*m_Gl(m_mesh.numberOfFaces()-1);
return m_Gl ; return m_Gl ;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment