diff --git a/src/main.cpp b/src/main.cpp index cf56b5daab85a9b359ba0de47addde96b053f327..c4ff74d54433a9d1820941e2036c24e604e2bf35 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,6 +13,7 @@ #include <Connectivity1D.hpp> #include <Mesh.hpp> +#include <BoundaryCondition.hpp> #include <AcousticSolver.hpp> #include <TinyVector.hpp> @@ -125,6 +126,17 @@ int main(int argc, char *argv[]) MeshType mesh(connectivity); MeshDataType mesh_data(mesh); + + std::vector<FacesBoundaryCondition> faces_bc_list; + { // quite dirty! + FacesBoundaryCondition bc0(FacesBoundaryCondition::symmetry, 0, + std::vector<unsigned int>({0u})); + faces_bc_list.push_back(bc0); + FacesBoundaryCondition bc1(FacesBoundaryCondition::symmetry, 0, + std::vector<unsigned int>({static_cast<unsigned int>(mesh.numberOfCells())})); + faces_bc_list.push_back(bc1); + } + UnknownsType unknowns(mesh_data); unknowns.initializeSod(); diff --git a/src/mesh/Mesh.hpp b/src/mesh/Mesh.hpp index cf199a9d52a048910a76503e84b0cdfb95588b49..53b593c78b4384af2df657c111953d201fb6eb71 100644 --- a/src/mesh/Mesh.hpp +++ b/src/mesh/Mesh.hpp @@ -43,6 +43,7 @@ public: return m_xr; } + KOKKOS_INLINE_FUNCTION Mesh(const Connectivity& connectivity) : m_connectivity(connectivity), m_xr("xr", connectivity.numberOfNodes()) diff --git a/src/scheme/AcousticSolver.hpp b/src/scheme/AcousticSolver.hpp index 6c6fcdeaefc904f619a56ce3ca6ab7aa898db484..1889f9f8381f4967ab2528958b37db5975492c19 100644 --- a/src/scheme/AcousticSolver.hpp +++ b/src/scheme/AcousticSolver.hpp @@ -40,17 +40,17 @@ private: typedef Kokkos::View<const double*>::size_type size_type; - KOKKOS_INLINE_FUNCTION void - operator() (const size_type i, value_type& update) const + KOKKOS_INLINE_FUNCTION + void operator() (const size_type i, value_type& update) const { if (x_(i) < update) { update = x_(i); } } - KOKKOS_INLINE_FUNCTION void - join (volatile value_type& dst, - const volatile value_type& src) const + KOKKOS_INLINE_FUNCTION + void join (volatile value_type& dst, + const volatile value_type& src) const { if (src < dst) { dst = src; diff --git a/src/scheme/BoundaryCondition.hpp b/src/scheme/BoundaryCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..17186a72b8229962d0da5c6335908087124df809 --- /dev/null +++ b/src/scheme/BoundaryCondition.hpp @@ -0,0 +1,60 @@ +#ifndef FACES_BOUNDARY_CONDITION_HPP +#define FACES_BOUNDARY_CONDITION_HPP + +#include <vector> + +class FacesBoundaryCondition +{ +public: + enum Type + { + velocity, + normal_velocity, + pressure, + symmetry + }; + +private: + const Type m_type; + const double m_value; + const size_t m_number_of_faces; + Kokkos::View<unsigned int*> m_face_list; + +public: + const size_t& numberOfFaces() const + { + return m_number_of_faces; + } + + const Kokkos::View<const unsigned int*> faceList() const + { + return m_face_list; + } + + const Type& type() const + { + return m_type; + } + + double value() const + { + return m_value; + } + + KOKKOS_INLINE_FUNCTION + FacesBoundaryCondition(const Type& type, + const double& value, + const std::vector<unsigned int>& faces) + : m_type(type), + m_value(value), + m_number_of_faces(faces.size()), + m_face_list("face_list", m_number_of_faces) + { + Kokkos::parallel_for(m_number_of_faces, KOKKOS_LAMBDA(const int& f){ + m_face_list[f]=faces[f]; + }); + } + ~FacesBoundaryCondition() = default; +}; + +#endif // FACES_BOUNDARY_CONDITION_HPP