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

modification sur Vl

parent 24631bc2
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ private:
Kokkos::View<Rd**> m_Cjr;
Kokkos::View<Rd*> m_xj;
Kokkos::View<double*> m_Vj;
Kokkos::View<double*> m_Dj;
Kokkos::View<double*> m_Vl;
KOKKOS_INLINE_FUNCTION
void _updateCenter()
......@@ -73,22 +73,29 @@ private:
}
// Ajout fonction pour calculer h_i+1/2
// PROBLEME Dj negatif parfois !
KOKKOS_INLINE_FUNCTION
void _updateVolumeCenter()
{
const Kokkos::View<const unsigned int**>& cell_nodes
= m_mesh.connectivity().cellNodes();
const Kokkos::View<const unsigned short*> cell_nb_nodes
= m_mesh.connectivity().cellNbNodes();
const Kokkos::View<const unsigned short*> face_nb_cells
= m_mesh.connectivity().faceNbCells();
const Kokkos::View<const unsigned short**> face_cell_local_face
= m_mesh.connectivity().faceCellLocalFace();
const Kokkos::View<const unsigned short*> cell_nb_faces
= m_mesh.connectivity().cellNbFaces();
Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){
double sum_cjr_xj = 0;
for (int R=0; R<cell_nb_nodes[j]; ++R) {
sum_cjr_xj += (m_xj[cell_nodes(j,R)], m_Cjr(j,R));
for (int l=0; l<cell_nb_faces(j); ++l) {
for (int R=0; R<face_nb_cells[l]; R++) {
sum_cjr_xj += (m_xj[cell_nodes(j,R)], m_Cjr(j,face_cell_local_face(l,R)));
}
}
m_Dj[j] = inv_dimension * sum_cjr_xj;
m_Vl[j] = inv_dimension * sum_cjr_xj;
});
}
......@@ -126,9 +133,9 @@ public:
return m_Vj;
}
const Kokkos::View<const double*> Dj() const
const Kokkos::View<const double*> Vl() const
{
return m_Dj;
return m_Vl;
}
void updateAllData()
......@@ -144,7 +151,7 @@ public:
m_Cjr("Cjr", mesh.numberOfCells(), mesh.connectivity().maxNbNodePerCell()),
m_xj("xj", mesh.numberOfCells()),
m_Vj("Vj", mesh.numberOfCells()),
m_Dj("Dj", mesh.numberOfCells())
m_Vl("Vl", mesh.numberOfCells())
{
if (dimension==1) {
// in 1d Cjr are computed once for all
......
......@@ -81,11 +81,11 @@ private:
const Kokkos::View<const unsigned int**>& cell_nodes = m_connectivity.cellNodes();
const Kokkos::View<const unsigned short*> cell_nb_nodes
= m_connectivity.cellNbNodes();
const Kokkos::View<const double*>& Dj = m_mesh_data.Dj();
const Kokkos::View<const double*>& Vl = m_mesh_data.Vl();
Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) {
for (int r=0; r<cell_nb_nodes[j]; ++r) {
m_Fjr(j,r) = ((kj(cell_nodes(j,r)) + kj(cell_nodes(j-1,r)))/(2*Dj(j)))
m_Fjr(j,r) = ((kj(cell_nodes(j,r)) + kj(cell_nodes(j-1,r)))/(2*Vl(j)))
* ((uj(j,r),Cjr(j,r))+ (uj(j-1,r),Cjr(j-1,r))) ; //tensorProduct(uj(j,r),Cjr(j,r)) ?
}
});
......@@ -162,20 +162,25 @@ public:
const Kokkos::View<const double*>& kj) const {
Kokkos::View<double*> dt_j("dt_j", m_mesh.numberOfCells());
const Kokkos::View<const Rd**> Cjr = m_mesh_data.Cjr();
const Kokkos::View<const double*>& Dj = m_mesh_data.Dj();
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.numberOfCells(), KOKKOS_LAMBDA(const int& j){
//dt_j[j]= 0.5*rhoj(j)*Vj(j)*(2./(kj(j+1) + 2*kj(j) + kj(j-1)))
// * std::min(Dj(j),Dj(j-1)); // ATTENTION : kj != 0 !
dt_j[j]= 0.5*rhoj(j)*Vj(j)*(2./(kj(j+1) + 2*kj(j) + kj(j-1)))
* std::min(Vl(j),Vl(j-1)); // ATTENTION : kj != 0 !
// * std::min(xj(j+1)-xj(j), xj(j)-xj(j-1));
// * std::min((Dxj(j+1),Cjr(j,1)) + (xj(j),Cjr(j,0)),
//(xj(j),Cjr(j,1)) + (xj(j-1),Cjr(j,0)) );
dt_j[j] = 0.0001;
//dt_j[j] = 0.0001;
std::cout << Vl(j) << std::endl;
//std::cout << std::min(Dj(j),Dj(j-1)) << std::endl;
// Le probleme vient aussi de Dj
});
double dt = std::numeric_limits<double>::max();
Kokkos::parallel_reduce(m_mesh.numberOfCells(), ReduceMin(dt_j), dt);
//std::cout << dt << std::endl;
return dt;
}
......
......@@ -173,7 +173,7 @@ public:
});
Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){
m_kj[j] = 0.1; // Par quoi initialiser k ?
m_kj[j] = 1;
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment