diff --git a/src/mesh/Connectivity1D.hpp b/src/mesh/Connectivity1D.hpp index ccaa7c065ab7baf4df52124cd737e9db8c6f8d1a..afc9e332cd50b009a428ead260929db68265c3e5 100644 --- a/src/mesh/Connectivity1D.hpp +++ b/src/mesh/Connectivity1D.hpp @@ -19,8 +19,6 @@ public: private: std::vector<RefNodeList> m_ref_node_list; - size_t m_number_of_nodes; - const size_t& m_number_of_faces = m_number_of_nodes; const size_t m_number_of_cells; const Kokkos::View<const unsigned int**> m_cell_nodes; @@ -30,15 +28,6 @@ private: Kokkos::View<double*> m_inv_cell_nb_nodes; const Kokkos::View<const unsigned short*>& m_cell_nb_faces = m_cell_nb_nodes; - Kokkos::View<const unsigned short*> m_node_nb_cells; - const Kokkos::View<const unsigned short*>& m_face_nb_cells = m_node_nb_cells; - - Kokkos::View<const unsigned int**> m_node_cells; - const Kokkos::View<const unsigned int**>& m_face_cells = m_node_cells; - - Kokkos::View<const unsigned short**> m_node_cell_local_node; - const Kokkos::View<const unsigned short**>& m_face_cell_local_face = m_node_cell_local_node; - size_t m_max_nb_node_per_cell; const Kokkos::View<const unsigned int**> @@ -82,14 +71,14 @@ public: return m_ref_node_list[i]; } - const size_t& numberOfNodes() const + size_t numberOfNodes() const { - return m_number_of_nodes; + return m_node_to_cell_matrix.numRows(); } - const size_t& numberOfFaces() const + size_t numberOfFaces() const { - return m_number_of_faces; + return m_node_to_cell_matrix.numRows(); } const size_t& numberOfCells() const @@ -112,11 +101,6 @@ public: return m_cell_faces; } - const Kokkos::View<const unsigned short*> nodeNbCells() const - { - return m_node_nb_cells; - } - const Kokkos::View<const unsigned short*> cellNbNodes() const { return m_cell_nb_nodes; @@ -132,31 +116,6 @@ public: return m_cell_nb_faces; } - const Kokkos::View<const unsigned short*> faceNbCells() const - { - return m_face_nb_cells; - } - - const Kokkos::View<const unsigned int**> nodeCells() const - { - return m_node_cells; - } - - const Kokkos::View<const unsigned int**> faceCells() const - { - return m_face_cells; - } - - const Kokkos::View<const unsigned short**> nodeCellLocalNode() const - { - return m_node_cell_local_node; - } - - const Kokkos::View<const unsigned short**> faceCellLocalFace() const - { - return m_face_cell_local_face; - } - Connectivity1D(const Connectivity1D&) = delete; Connectivity1D(const size_t& number_of_cells) @@ -175,10 +134,6 @@ public: m_cell_nb_nodes, m_number_of_cells, m_max_nb_node_per_cell, - m_number_of_nodes, - m_node_nb_cells, - m_node_cells, - m_node_cell_local_node, m_node_to_cell_matrix, m_node_to_cell_local_node_matrix); } @@ -199,10 +154,6 @@ public: m_cell_nb_nodes, m_number_of_cells, m_max_nb_node_per_cell, - m_number_of_nodes, - m_node_nb_cells, - m_node_cells, - m_node_cell_local_node, m_node_to_cell_matrix, m_node_to_cell_local_node_matrix); } diff --git a/src/mesh/Connectivity2D.hpp b/src/mesh/Connectivity2D.hpp index 57b5dd5b1f753630272d0277efc5890492c1c421..ef2ce6926710807e37b9dd3e7ed3944496b895e6 100644 --- a/src/mesh/Connectivity2D.hpp +++ b/src/mesh/Connectivity2D.hpp @@ -28,7 +28,6 @@ class Connectivity2D const size_t m_number_of_cells; size_t m_number_of_faces; - size_t m_number_of_nodes; const Kokkos::View<const unsigned short*> m_cell_nb_nodes; const Kokkos::View<const unsigned int**> m_cell_nodes; @@ -37,10 +36,6 @@ class Connectivity2D Kokkos::View<const unsigned short*> m_cell_nb_faces; Kokkos::View<unsigned int**> m_cell_faces; - Kokkos::View<const unsigned short*> m_node_nb_cells; - Kokkos::View<const unsigned int**> m_node_cells; - Kokkos::View<const unsigned short**> m_node_cell_local_node; - Kokkos::View<unsigned short*> m_face_nb_cells; Kokkos::View<unsigned int**> m_face_cells; Kokkos::View<unsigned short**> m_face_cell_local_face; @@ -214,9 +209,9 @@ class Connectivity2D return m_ref_node_list[i]; } - const size_t& numberOfNodes() const + size_t numberOfNodes() const { - return m_number_of_nodes; + return m_node_to_cell_matrix.numRows(); } const size_t& numberOfFaces() const @@ -323,10 +318,6 @@ class Connectivity2D m_cell_nb_nodes, m_number_of_cells, m_max_nb_node_per_cell, - m_number_of_nodes, - m_node_nb_cells, - m_node_cells, - m_node_cell_local_node, m_node_to_cell_matrix, m_node_to_cell_local_node_matrix); diff --git a/src/mesh/Connectivity3D.hpp b/src/mesh/Connectivity3D.hpp index ca5b022553bd42c7c214a744c3366813f5c482a7..973cbe43024140d91fedf53a4960e5994392257d 100644 --- a/src/mesh/Connectivity3D.hpp +++ b/src/mesh/Connectivity3D.hpp @@ -32,7 +32,6 @@ private: const size_t m_number_of_cells; size_t m_number_of_faces; - size_t m_number_of_nodes; const Kokkos::View<const unsigned short*> m_cell_nb_nodes; const Kokkos::View<const unsigned int**> m_cell_nodes; @@ -42,10 +41,6 @@ private: Kokkos::View<const unsigned int**> m_cell_faces; Kokkos::View<const bool**> m_cell_faces_is_reversed; - Kokkos::View<const unsigned short*> m_node_nb_cells; - Kokkos::View<const unsigned int**> m_node_cells; - Kokkos::View<const unsigned short**> m_node_cell_local_node; - Kokkos::View<const unsigned short*> m_face_nb_cells; Kokkos::View<const unsigned int**> m_face_cells; Kokkos::View<const unsigned short**> m_face_cell_local_face; @@ -387,7 +382,7 @@ private: node_faces_map[r].push_back(l); } } - Kokkos::View<unsigned short*> node_nb_faces("node_nb_faces", m_number_of_nodes); + Kokkos::View<unsigned short*> node_nb_faces("node_nb_faces", this->numberOfNodes()); size_t max_nb_face_per_node = 0; for (auto node_faces : node_faces_map) { max_nb_face_per_node = std::max(node_faces.second.size(), max_nb_face_per_node); @@ -395,7 +390,7 @@ private: } m_node_nb_faces = node_nb_faces; - Kokkos::View<unsigned int**> node_faces("node_faces", m_number_of_nodes, max_nb_face_per_node); + Kokkos::View<unsigned int**> node_faces("node_faces", this->numberOfNodes(), max_nb_face_per_node); for (auto node_faces_vector : node_faces_map) { const unsigned int r = node_faces_vector.first; const std::vector<unsigned int>& faces_vector = node_faces_vector.second; @@ -437,9 +432,10 @@ private: return m_ref_node_list[i]; } - const size_t& numberOfNodes() const + KOKKOS_INLINE_FUNCTION + size_t numberOfNodes() const { - return m_number_of_nodes; + return m_node_to_cell_matrix.numRows(); } const size_t& numberOfFaces() const @@ -555,10 +551,6 @@ private: m_cell_nb_nodes, m_number_of_cells, m_max_nb_node_per_cell, - m_number_of_nodes, - m_node_nb_cells, - m_node_cells, - m_node_cell_local_node, m_node_to_cell_matrix, m_node_to_cell_local_node_matrix); diff --git a/src/mesh/ConnectivityUtils.hpp b/src/mesh/ConnectivityUtils.hpp index 20acc1885d6e9d3b33515faa8b8577ea88e4bf5f..d9f1926931fb0e37dd61611bb98b2491309ca2ac 100644 --- a/src/mesh/ConnectivityUtils.hpp +++ b/src/mesh/ConnectivityUtils.hpp @@ -14,10 +14,6 @@ class ConnectivityUtils const Kokkos::View<const unsigned short*> cell_nb_nodes, const size_t& number_of_cells, size_t& max_nb_node_per_cell, - size_t& number_of_nodes, - Kokkos::View<const unsigned short*>& node_nb_cells, - Kokkos::View<const unsigned int**>& node_cells, - Kokkos::View<const unsigned short**>& node_cell_local_node, ConnectivityMatrix& node_to_cell_matrix, ConnectivityMatrix& node_to_cell_local_node_matrix) { @@ -46,29 +42,6 @@ class ConnectivityUtils } } - number_of_nodes = node_cells_map.size(); - - Kokkos::View<unsigned short*> built_node_nb_cells("node_nb_cells", node_cells_map.size()); - size_t max_node_cells = 0; - for (const auto& i_cell_vector : node_cells_map) { - const auto& [i, cells_vector] = i_cell_vector; - const size_t nb_cells = cells_vector.size(); - built_node_nb_cells[i] = nb_cells; - if (nb_cells > max_node_cells) { - max_node_cells = nb_cells; - } - } - node_nb_cells = built_node_nb_cells; - - Kokkos::View<unsigned int**> built_node_cells("node_cells", node_cells_map.size(), max_node_cells); - for (const auto& i_cell_vector : node_cells_map) { - const auto& [i, cells_vector] = i_cell_vector; - for (size_t j=0; j<cells_vector.size(); ++j) { - built_node_cells(i,j) = cells_vector[j]; - } - } - node_cells = built_node_cells; - std::vector<std::vector<unsigned int>> node_to_cell_vector(node_cells_map.size()); for (const auto& i_cell_vector : node_cells_map) { const auto& [r, cells_vector] = i_cell_vector; @@ -77,26 +50,12 @@ class ConnectivityUtils node_to_cell_matrix = Kokkos::create_staticcrsgraph<ConnectivityMatrix>("node_to_cell_matrix", node_to_cell_vector); - Kokkos::View<unsigned short**> built_node_cell_local_node("node_cell_local_node", - node_cells_map.size(), max_node_cells); - Kokkos::parallel_for(number_of_nodes, KOKKOS_LAMBDA(const unsigned int& r){ - for (unsigned short J=0; J<node_nb_cells[r]; ++J) { - const unsigned int j = node_cells(r,J); - for (unsigned int R=0; R<cell_nb_nodes[j]; ++R) { - if (cell_nodes(j,R) == r) { - built_node_cell_local_node(r,J)=R; - break; - } - } - } - }); - node_cell_local_node = built_node_cell_local_node; - std::vector<std::vector<unsigned int>> node_to_cell_local_node_vector(node_cells_map.size()); for (unsigned int r=0; r<node_cells_map.size(); ++r) { - node_to_cell_local_node_vector[r].resize(node_nb_cells[r]); - for (unsigned short J=0; J<node_nb_cells[r]; ++J) { - const unsigned int j = node_cells(r,J); + const auto& node_to_cell = node_to_cell_matrix.rowConst(r); + node_to_cell_local_node_vector[r].resize(node_to_cell.length); + for (unsigned short J=0; J<node_to_cell.length; ++J) { + const unsigned int j = node_to_cell(J); for (unsigned int R=0; R<cell_nb_nodes[j]; ++R) { if (cell_nodes(j,R) == r) { node_to_cell_local_node_vector[r][J] = R; diff --git a/src/mesh/Mesh.hpp b/src/mesh/Mesh.hpp index 2b05731f54a466635d43996319314968d1da5bb1..9d3d596c26dd5117890e1071771f47fba0057d08 100644 --- a/src/mesh/Mesh.hpp +++ b/src/mesh/Mesh.hpp @@ -36,7 +36,8 @@ public: return *m_connectivity; } - const size_t& numberOfNodes() const + KOKKOS_INLINE_FUNCTION + size_t numberOfNodes() const { return m_connectivity->numberOfNodes(); } diff --git a/src/scheme/AcousticSolver.hpp b/src/scheme/AcousticSolver.hpp index 3ed9eaa3ad88661181d7d95a739c10e9cd3ae3fc..dadcc82fbd31b916455593e9e099f2218da52a60 100644 --- a/src/scheme/AcousticSolver.hpp +++ b/src/scheme/AcousticSolver.hpp @@ -47,16 +47,16 @@ private: void operator() (const size_type i, value_type& update) const { if (x_(i) < update) { - update = x_(i); + update = x_(i); } } KOKKOS_INLINE_FUNCTION void join (volatile value_type& dst, - const volatile value_type& src) const + const volatile value_type& src) const { if (src < dst) { - dst = src; + dst = src; } } @@ -67,14 +67,13 @@ private: } }; - KOKKOS_INLINE_FUNCTION const Kokkos::View<const double*> computeRhoCj(const Kokkos::View<const double*>& rhoj, - const Kokkos::View<const double*>& cj) + const Kokkos::View<const double*>& cj) { Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) { - m_rhocj[j] = rhoj[j]*cj[j]; + m_rhocj[j] = rhoj[j]*cj[j]; }); return m_rhocj; } @@ -82,15 +81,15 @@ private: KOKKOS_INLINE_FUNCTION const Kokkos::View<const Rdd**> computeAjr(const Kokkos::View<const double*>& rhocj, - const Kokkos::View<const double**>& ljr, - const Kokkos::View<const Rd**>& njr) { + const Kokkos::View<const double**>& ljr, + const Kokkos::View<const Rd**>& njr) { const Kokkos::View<const unsigned short*> cell_nb_nodes = m_connectivity.cellNbNodes(); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) { - for (int r=0; r<cell_nb_nodes[j]; ++r) { - m_Ajr(j,r) = tensorProduct((rhocj(j)*ljr(j,r))*njr(j,r), njr(j,r)); - } + for (int r=0; r<cell_nb_nodes[j]; ++r) { + m_Ajr(j,r) = tensorProduct((rhocj(j)*ljr(j,r))*njr(j,r), njr(j,r)); + } }); return m_Ajr; @@ -100,15 +99,15 @@ private: const Kokkos::View<const Rdd*> computeAr(const Kokkos::View<const Rdd**>& Ajr) { Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const int& r) { - Rdd sum = zero; + Rdd sum = zero; const auto& node_to_cell = m_connectivity.m_node_to_cell_matrix.rowConst(r); const auto& node_to_cell_local_node = m_connectivity.m_node_to_cell_local_node_matrix.rowConst(r); - for (size_t j=0; j<node_to_cell.length; ++j) { + for (size_t j=0; j<node_to_cell.length; ++j) { const unsigned int J = node_to_cell(j); const unsigned int R = node_to_cell_local_node(j); - sum += Ajr(J,R); - } - m_Ar(r) = sum; + sum += Ajr(J,R); + } + m_Ar(r) = sum; }); return m_Ar; @@ -117,19 +116,19 @@ private: KOKKOS_INLINE_FUNCTION const Kokkos::View<const Rd*> computeBr(const Kokkos::View<const Rdd**>& Ajr, - const Kokkos::View<const Rd**>& Cjr, - const Kokkos::View<const Rd*>& uj, - const Kokkos::View<const double*>& pj) { + const Kokkos::View<const Rd**>& Cjr, + const Kokkos::View<const Rd*>& uj, + const Kokkos::View<const double*>& pj) { Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const int& r) { - Rd& br = m_br(r); - br = zero; + Rd& br = m_br(r); + br = zero; const auto& node_to_cell = m_connectivity.m_node_to_cell_matrix.rowConst(r); const auto& node_to_cell_local_node = m_connectivity.m_node_to_cell_local_node_matrix.rowConst(r); - for (size_t j=0; j<node_to_cell.length; ++j) { + for (size_t j=0; j<node_to_cell.length; ++j) { const unsigned int J = node_to_cell(j); const unsigned int R = node_to_cell_local_node(j); - br += Ajr(J,R)*uj(J) + pj(J)*Cjr(J,R); - } + br += Ajr(J,R)*uj(J) + pj(J)*Cjr(J,R); + } }); return m_br; @@ -140,59 +139,39 @@ private: for (const auto& handler : m_boundary_condition_list) { switch (handler.boundaryCondition().type()) { case BoundaryCondition::normal_velocity: { - std::cerr << "normal_velocity NIY\n"; - std::exit(0); - break; + std::cerr << __FILE__ << ':' << __LINE__ << ": normal_velocity BC NIY\n"; + std::exit(0); + break; } case BoundaryCondition::velocity: { - std::cerr << "velocity NIY\n"; - std::exit(0); - break; + std::cerr << __FILE__ << ':' << __LINE__ << ": velocity BC NIY\n"; + std::exit(0); + break; } case BoundaryCondition::pressure: { - const PressureBoundaryCondition& pressure_bc - = dynamic_cast<const PressureBoundaryCondition&>(handler.boundaryCondition()); - const Kokkos::View<const unsigned int**> face_cells - = m_connectivity.faceCells(); - const Kokkos::View<const unsigned short**> face_cell_local_face - = m_connectivity.faceCellLocalFace(); - const Kokkos::View<const Rd**> Cjr - = m_mesh_data.Cjr(); - - Kokkos::parallel_for(pressure_bc.numberOfFaces(), KOKKOS_LAMBDA(const int& l_number) { - // quite ugly: node/faces are melt in a bad way... at least works in 1d... - const int l = pressure_bc.faceList()[l_number]; - Assert(m_connectivity.faceNbCells()[l] == 1); -#warning remove this specialization - if constexpr(dimension ==3) { - const unsigned int j = m_connectivity.m_face_to_cell_matrix.entries(l); //face_cells(l,0); - const unsigned int L = face_cell_local_face(l,0); - m_br(l) -= pressure_bc.value()*Cjr(j,L); - } else { - const unsigned int j = face_cells(l,0); - const unsigned int L = face_cell_local_face(l,0); - m_br(l) -= pressure_bc.value()*Cjr(j,L); - } - }); - break; + // const PressureBoundaryCondition& pressure_bc + // = dynamic_cast<const PressureBoundaryCondition&>(handler.boundaryCondition()); + std::cerr << __FILE__ << ':' << __LINE__ << ": pressure BC NIY\n"; + std::exit(0); + break; } case BoundaryCondition::symmetry: { - const SymmetryBoundaryCondition<dimension>& symmetry_bc - = dynamic_cast<const SymmetryBoundaryCondition<dimension>&>(handler.boundaryCondition()); - const Rd& n = symmetry_bc.outgoingNormal(); - - const Rdd I = identity; - const Rdd nxn = tensorProduct(n,n); - const Rdd P = I-nxn; - - Kokkos::parallel_for(symmetry_bc.numberOfNodes(), KOKKOS_LAMBDA(const int& r_number) { - const int r = symmetry_bc.nodeList()[r_number]; - // assert(m_connectivity.nodeNbCells()[r] == 1); - - m_Ar(r) = P*m_Ar(r)*P + nxn; - m_br(r) = P*m_br(r); - }); - break; + const SymmetryBoundaryCondition<dimension>& symmetry_bc + = dynamic_cast<const SymmetryBoundaryCondition<dimension>&>(handler.boundaryCondition()); + const Rd& n = symmetry_bc.outgoingNormal(); + + const Rdd I = identity; + const Rdd nxn = tensorProduct(n,n); + const Rdd P = I-nxn; + + Kokkos::parallel_for(symmetry_bc.numberOfNodes(), KOKKOS_LAMBDA(const int& r_number) { + const int r = symmetry_bc.nodeList()[r_number]; + // assert(m_connectivity.nodeNbCells()[r] == 1); + + m_Ar(r) = P*m_Ar(r)*P + nxn; + m_br(r) = P*m_br(r); + }); + break; } } } @@ -200,11 +179,11 @@ private: Kokkos::View<Rd*> computeUr(const Kokkos::View<const Rdd*>& Ar, - const Kokkos::View<const Rd*>& br) { + const Kokkos::View<const Rd*>& br) { inverse(Ar, m_inv_Ar); const Kokkos::View<const Rdd*> invAr = m_inv_Ar; Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const int& r) { - m_ur[r]=invAr(r)*br(r); + m_ur[r]=invAr(r)*br(r); }); return m_ur; @@ -212,18 +191,18 @@ private: Kokkos::View<Rd**> computeFjr(const Kokkos::View<const Rdd**>& Ajr, - const Kokkos::View<const Rd*>& ur, - const Kokkos::View<const Rd**>& Cjr, - const Kokkos::View<const Rd*>& uj, - const Kokkos::View<const double*>& pj) { + const Kokkos::View<const Rd*>& ur, + const Kokkos::View<const Rd**>& Cjr, + const Kokkos::View<const Rd*>& uj, + const Kokkos::View<const double*>& pj) { const Kokkos::View<const unsigned int**>& cell_nodes = m_connectivity.cellNodes(); const Kokkos::View<const unsigned short*> cell_nb_nodes = m_connectivity.cellNbNodes(); 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) = Ajr(j,r)*(uj(j)-ur(cell_nodes(j,r)))+pj(j)*Cjr(j,r); - } + for (int r=0; r<cell_nb_nodes[j]; ++r) { + m_Fjr(j,r) = Ajr(j,r)*(uj(j)-ur(cell_nodes(j,r)))+pj(j)*Cjr(j,r); + } }); return m_Fjr; @@ -236,24 +215,17 @@ private: }); } - void inverse(const Kokkos::View<const double*>& x, - Kokkos::View<double*>& inv_x) const { - Kokkos::parallel_for(x.size(), KOKKOS_LAMBDA(const int& r) { - inv_x(r) = 1./x(r); - }); - } - KOKKOS_INLINE_FUNCTION void computeExplicitFluxes(const Kokkos::View<const Rd*>& xr, - const Kokkos::View<const Rd*>& xj, - const Kokkos::View<const double*>& rhoj, - const Kokkos::View<const Rd*>& uj, - const Kokkos::View<const double*>& pj, - const Kokkos::View<const double*>& cj, - const Kokkos::View<const double*>& Vj, - const Kokkos::View<const Rd**>& Cjr, - const Kokkos::View<const double**>& ljr, - const Kokkos::View<const Rd**>& njr) { + const Kokkos::View<const Rd*>& xj, + const Kokkos::View<const double*>& rhoj, + const Kokkos::View<const Rd*>& uj, + const Kokkos::View<const double*>& pj, + const Kokkos::View<const double*>& cj, + const Kokkos::View<const double*>& Vj, + const Kokkos::View<const Rd**>& Cjr, + const Kokkos::View<const double**>& ljr, + const Kokkos::View<const Rd**>& njr) { const Kokkos::View<const double*> rhocj = computeRhoCj(rhoj, cj); const Kokkos::View<const Rdd**> Ajr = computeAjr(rhocj, ljr, njr); @@ -279,8 +251,8 @@ private: public: AcousticSolver(MeshData& mesh_data, - UnknownsType& unknowns, - const std::vector<BoundaryConditionHandler>& bc_list) + UnknownsType& unknowns, + const std::vector<BoundaryConditionHandler>& bc_list) : m_mesh_data(mesh_data), m_mesh(mesh_data.mesh()), m_connectivity(m_mesh.connectivity()), @@ -299,17 +271,17 @@ public: KOKKOS_INLINE_FUNCTION double acoustic_dt(const Kokkos::View<const double*>& Vj, - const Kokkos::View<const double*>& cj) const { + const Kokkos::View<const double*>& cj) const { const Kokkos::View<const double**> ljr = m_mesh_data.ljr(); const Kokkos::View<const unsigned short*>& cell_nb_nodes = m_connectivity.cellNbNodes(); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ - double S = 0; - for (int r=0; r<cell_nb_nodes(j); ++r) { - S += ljr(j,r); - } - m_Vj_over_cj[j] = 2*Vj[j]/(S*cj[j]); + double S = 0; + for (int r=0; r<cell_nb_nodes(j); ++r) { + S += ljr(j,r); + } + m_Vj_over_cj[j] = 2*Vj[j]/(S*cj[j]); }); double dt = std::numeric_limits<double>::max(); @@ -320,7 +292,7 @@ public: void computeNextStep(const double& t, const double& dt, - UnknownsType& unknowns) + UnknownsType& unknowns) { Kokkos::View<double*> rhoj = unknowns.rhoj(); Kokkos::View<Rd*> uj = unknowns.uj(); @@ -349,30 +321,30 @@ public: const Kokkos::View<const double*> inv_mj = unknowns.invMj(); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) { - Rd momentum_fluxes = zero; - double energy_fluxes = 0; - for (int R=0; R<cell_nb_nodes[j]; ++R) { - const int r=cell_nodes(j,R); - momentum_fluxes += Fjr(j,R); - energy_fluxes += (Fjr(j,R), ur[r]); - } - uj[j] -= (dt*inv_mj[j]) * momentum_fluxes; - Ej[j] -= (dt*inv_mj[j]) * energy_fluxes; + Rd momentum_fluxes = zero; + double energy_fluxes = 0; + for (int R=0; R<cell_nb_nodes[j]; ++R) { + const int r=cell_nodes(j,R); + momentum_fluxes += Fjr(j,R); + energy_fluxes += (Fjr(j,R), ur[r]); + } + uj[j] -= (dt*inv_mj[j]) * momentum_fluxes; + Ej[j] -= (dt*inv_mj[j]) * energy_fluxes; }); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j) { - ej[j] = Ej[j] - 0.5 * (uj[j],uj[j]); + ej[j] = Ej[j] - 0.5 * (uj[j],uj[j]); }); Kokkos::parallel_for(m_mesh.numberOfNodes(), KOKKOS_LAMBDA(const int& r){ - xr[r] += dt*ur[r]; + xr[r] += dt*ur[r]; }); m_mesh_data.updateAllData(); const Kokkos::View<const double*> mj = unknowns.mj(); Kokkos::parallel_for(m_mesh.numberOfCells(), KOKKOS_LAMBDA(const int& j){ - rhoj[j] = mj[j]/Vj[j]; + rhoj[j] = mj[j]/Vj[j]; }); } };