diff --git a/CMakeLists.txt b/CMakeLists.txt index 89d8e6d..399687d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # project settings cmake_minimum_required(VERSION 3.18) -project(CajitaFluids LANGUAGES C CXX VERSION 0.1.0) +project(CabanaFluids LANGUAGES C CXX VERSION 0.1.0) include(GNUInstallDirs) @@ -54,14 +54,14 @@ endif() include(${BLT_SOURCE_DIR}/SetupBLT.cmake) # Get the dependent packages we need -find_package(Cabana REQUIRED COMPONENTS Cabana::Cajita Cabana::cabanacore) +find_package(Cabana REQUIRED COMPONENTS Cabana::Core Cabana::Grid) if( NOT Cabana_ENABLE_MPI ) message( FATAL_ERROR "Cabana must be compiled with MPI" ) endif() -if( NOT Cabana_ENABLE_CAJITA ) - message( FATAL_ERROR "Cabana must be compiled with Cajita" ) +if( NOT Cabana_ENABLE_GRID ) + message( FATAL_ERROR "Cabana must be compiled with grid support" ) endif() -find_package(Silo REQUIRED) +find_package(SILO REQUIRED) # Get Clang Format to use for making sure the resulting code is # properly formatted diff --git a/cmake/FindSILO.cmake b/cmake/FindSILO.cmake new file mode 100644 index 0000000..bd72901 --- /dev/null +++ b/cmake/FindSILO.cmake @@ -0,0 +1,20 @@ +find_package(PkgConfig QUIET) +pkg_check_modules(PC_SILO silo QUIET) + +find_path(SILO_INCLUDE_DIR silo.h pmpio.h HINTS ${PC_SILO_INCLUDE_DIRS}) +find_library(SILO_LIBRARY NAMES silo siloh5 HINTS ${PC_SILO_LIBRARY_DIRS}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SILO DEFAULT_MSG SILO_INCLUDE_DIR SILO_LIBRARY) + +mark_as_advanced(SILO_INCLUDE_DIR SILO_LIBRARY) + +if(SILO_INCLUDE_DIR AND SILO_LIBRARY AND NOT TARGET SILO::silo) + add_library(SILO::silo UNKNOWN IMPORTED) + set_target_properties(SILO::silo PROPERTIES + IMPORTED_LOCATION ${SILO_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${SILO_INCLUDE_DIR}) + if(SILO_LINK_FLAGS) + set_property(TARGET SILO::silo APPEND_STRING PROPERTY INTERFACE_LINK_LIBRARIES " ${SILO_LINK_FLAGS}") + endif() +endif() diff --git a/cmake/FindSilo.cmake b/cmake/FindSilo.cmake deleted file mode 100644 index aa621d1..0000000 --- a/cmake/FindSilo.cmake +++ /dev/null @@ -1,20 +0,0 @@ -find_package(PkgConfig QUIET) -pkg_check_modules(PC_Silo silo QUIET) - -find_path(Silo_INCLUDE_DIR silo.h pmpio.h HINTS ${PC_Silo_INCLUDE_DIRS}) -find_library(Silo_LIBRARY NAMES silo siloh5 HINTS ${PC_Silo_LIBRARY_DIRS}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Silo DEFAULT_MSG Silo_INCLUDE_DIR Silo_LIBRARY) - -mark_as_advanced(Silo_INCLUDE_DIR Silo_LIBRARY) - -if(Silo_INCLUDE_DIR AND Silo_LIBRARY) - add_library(Silo::silo UNKNOWN IMPORTED) - set_target_properties(Silo::silo PROPERTIES - IMPORTED_LOCATION ${Silo_LIBRARY} - INTERFACE_INCLUDE_DIRECTORIES ${Silo_INCLUDE_DIR}) - if(Silo_LINK_FLAGS) - set_property(TARGET Silo::silo APPEND_STRING PROPERTY INTERFACE_LINK_LIBRARIES " ${Silo_LINK_FLAGS}") - endif() -endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 1d1ac84..b7e01fe 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -3,4 +3,5 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) blt_add_executable( NAME advection SOURCES advection.cpp - DEPENDS_ON cajitafluids) + DEPENDS_ON cabanafluids) +install( TARGETS advection DESTINATION ${CMAKE_INSTALL_BINDIR} ) diff --git a/examples/advection.cpp b/examples/advection.cpp index 2e7afe7..bc2e38f 100644 --- a/examples/advection.cpp +++ b/examples/advection.cpp @@ -12,14 +12,14 @@ #define DEBUG 0 #endif -//#define HYPRE +// #define HYPRE // Include Statements #include #include #include -#include +#include #include #include @@ -34,7 +34,7 @@ #include #include -using namespace CajitaFluids; +using namespace CabanaFluids; // Short Args: n - Cell Count, s - Domain Size, // x - On-node Parallelism ( Serial/Threaded/OpenMP/CUDA ), @@ -183,10 +183,10 @@ int parseInput( const int rank, const int argc, char** argv, ClArgs& cl ) cl.density = 0.1; cl.gravity = 0.0; - // Default to the Hypre conjugate gradient solver with a sophisticated - // preconditioner - cl.solver = "PCG"; - cl.precon = "PFMG"; + // Default to the Hypre conjugate gradient solver with a simple + // jacobi preconditioner + cl.solver = "Reference"; + cl.precon = "Jacobi"; int ch; // Now parse any arguments @@ -393,7 +393,7 @@ struct MeshInitFunc }; KOKKOS_INLINE_FUNCTION - bool operator()( Cajita::Cell, CajitaFluids::Field::Quantity, + bool operator()( Cabana::Grid::Cell, CabanaFluids::Field::Quantity, [[maybe_unused]] const int index[Dim], [[maybe_unused]] const double x[Dim], double& quantity ) const @@ -403,8 +403,8 @@ struct MeshInitFunc return true; }; KOKKOS_INLINE_FUNCTION - bool operator()( Cajita::Face, - CajitaFluids::Field::Velocity, + bool operator()( Cabana::Grid::Face, + CabanaFluids::Field::Velocity, [[maybe_unused]] const int index[Dim], [[maybe_unused]] const double x[Dim], double& xvelocity ) const @@ -413,8 +413,8 @@ struct MeshInitFunc return true; }; KOKKOS_INLINE_FUNCTION - bool operator()( Cajita::Face, - CajitaFluids::Field::Velocity, + bool operator()( Cabana::Grid::Face, + CabanaFluids::Field::Velocity, [[maybe_unused]] const int index[Dim], [[maybe_unused]] const double x[Dim], double& yvelocity ) const @@ -424,7 +424,7 @@ struct MeshInitFunc } #if 0 KOKKOS_INLINE_FUNCTION - bool operator()( Cajita::Face, + bool operator()( Cabana::Grid::Face, [[maybe_unused]] const int coords[Dim], [[maybe_unused]] const int x[Dim], double &zvelocity ) const { @@ -441,18 +441,19 @@ void advect( ClArgs& cl ) MPI_Comm_size( MPI_COMM_WORLD, &comm_size ); // Number of Ranks MPI_Comm_rank( MPI_COMM_WORLD, &rank ); // Get My Rank - Cajita::DimBlockPartitioner<2> partitioner; // Create Cajita Partitioner - CajitaFluids::BoundaryCondition<2> bc; + Cabana::Grid::DimBlockPartitioner<2> + partitioner; // Create Cabana Grid Partitioner + CabanaFluids::BoundaryCondition<2> bc; bc.boundary_type = { - CajitaFluids::BoundaryType::SOLID, CajitaFluids::BoundaryType::SOLID, - CajitaFluids::BoundaryType::SOLID, CajitaFluids::BoundaryType::SOLID }; + CabanaFluids::BoundaryType::SOLID, CabanaFluids::BoundaryType::SOLID, + CabanaFluids::BoundaryType::SOLID, CabanaFluids::BoundaryType::SOLID }; - CajitaFluids::InflowSource<2> source( cl.inLocation, cl.inSize, + CabanaFluids::InflowSource<2> source( cl.inLocation, cl.inSize, cl.inVelocity, cl.inQuantity ); - CajitaFluids::BodyForce<2> body( 0.0, -cl.gravity ); + CabanaFluids::BodyForce<2> body( 0.0, -cl.gravity ); MeshInitFunc<2> initializer( 0.0, { 0.0, 0.0 } ); - auto solver = CajitaFluids::createSolver( + auto solver = CabanaFluids::createSolver( cl.device, MPI_COMM_WORLD, cl.global_bounding_box, cl.global_num_cells, partitioner, cl.density, initializer, bc, source, body, cl.delta_t, cl.solver, cl.precon ); @@ -479,7 +480,7 @@ int main( int argc, char* argv[] ) if ( rank == 0 ) { // Print Command Line Options - std::cout << "CajitaFluids\n"; + std::cout << "CabanaFluids\n"; std::cout << "=======Command line arguments=======\n"; std::cout << std::left << std::setw( 20 ) << "Thread Setting" << ": " << std::setw( 8 ) << cl.device diff --git a/src/BodyForce.hpp b/src/BodyForce.hpp index 47c01d9..67c39c1 100644 --- a/src/BodyForce.hpp +++ b/src/BodyForce.hpp @@ -3,22 +3,24 @@ * @author Patrick Bridges * * @section DESCRIPTION - * Inflow Sources Conditions for CajitaFluids + * Inflow Sources Conditions for CabanaFluids */ -#ifndef CAJITAFLUIDS_BODYFORCE_HPP -#define CAJITAFLUIDS_BODYFORCE_HPP +#ifndef CABANAFLUIDS_BODYFORCE_HPP +#define CABANAFLUIDS_BODYFORCE_HPP #ifndef DEBUG #define DEBUG 0 #endif // Include Statements -#include - +#include +#include #include -namespace CajitaFluids +#include + +namespace CabanaFluids { /** * @struct BodyForce @@ -32,7 +34,7 @@ struct BodyForce<2> { template KOKKOS_INLINE_FUNCTION void - operator()( Cajita::Cell, [[maybe_unused]] ArrayType& d, + operator()( Cabana::Grid::Cell, [[maybe_unused]] ArrayType& d, [[maybe_unused]] int i, [[maybe_unused]] int j, [[maybe_unused]] double x, [[maybe_unused]] double y, [[maybe_unused]] double delta_t, @@ -43,8 +45,8 @@ struct BodyForce<2> /* Simple forward Euler for body forces */ template KOKKOS_INLINE_FUNCTION void - operator()( Cajita::Face, ArrayType& ux, int i, int j, - [[maybe_unused]] double x, [[maybe_unused]] double y, + operator()( Cabana::Grid::Face, ArrayType& ux, int i, + int j, [[maybe_unused]] double x, [[maybe_unused]] double y, double delta_t, [[maybe_unused]] double v ) const { ux( i, j, 0 ) += _force[0] * delta_t; @@ -52,8 +54,8 @@ struct BodyForce<2> template KOKKOS_INLINE_FUNCTION void - operator()( Cajita::Face, ArrayType& uy, int i, int j, - [[maybe_unused]] double x, [[maybe_unused]] double y, + operator()( Cabana::Grid::Face, ArrayType& uy, int i, + int j, [[maybe_unused]] double x, [[maybe_unused]] double y, double delta_t, [[maybe_unused]] double v ) const { uy( i, j, 0 ) += _force[1] * delta_t; @@ -67,6 +69,6 @@ struct BodyForce<2> Kokkos::Array _force; /**< Force exerted on all cells. */ }; -} // namespace CajitaFluids +} // namespace CabanaFluids #endif diff --git a/src/BoundaryConditions.hpp b/src/BoundaryConditions.hpp index d5b87dd..1390c37 100644 --- a/src/BoundaryConditions.hpp +++ b/src/BoundaryConditions.hpp @@ -4,22 +4,24 @@ * @author Jered Dominguez-Trujillo * * @section DESCRIPTION - * Boundary Conditions for ExaCLAMR Shallow Water Solver + * Boundary Conditions for CabanaFluids advection solver */ -#ifndef EXACLAMR_BOUNDARYCONDITIONS_HPP -#define EXACLAMR_BOUNDARYCONDITIONS_HPP +#ifndef CABANAFLUIDS_BOUNDARYCONDITIONS_HPP +#define CABANAFLUIDS_BOUNDARYCONDITIONS_HPP #ifndef DEBUG #define DEBUG 0 #endif // Include Statements -#include - +#include +#include #include -namespace CajitaFluids +#include + +namespace CabanaFluids { /** * @struct BoundaryType @@ -50,9 +52,9 @@ struct BoundaryCondition; template <> struct BoundaryCondition<2> { - using Cell = Cajita::Cell; - using FaceI = Cajita::Face; - using FaceJ = Cajita::Face; + using Cell = Cabana::Grid::Cell; + using FaceI = Cabana::Grid::Face; + using FaceJ = Cabana::Grid::Face; template KOKKOS_INLINE_FUNCTION void build_matrix( const int gi, const int gj, const int i, const int j, @@ -134,6 +136,6 @@ struct BoundaryCondition<2> Kokkos::Array max; }; -} // namespace CajitaFluids +} // namespace CabanaFluids #endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e7d7f9e..f9d5ae5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,10 +16,10 @@ set(SOURCES ) set(DEPENDS_ON - Cabana::cabanacore - Cabana::Cajita - Silo::silo - mpi + Cabana::Core + Cabana::Grid + SILO::silo + MPI::MPI_CXX ) set(INCLUDES @@ -27,7 +27,7 @@ set(INCLUDES ${CMAKE_CURRENT_BINARY_DIR} ) -blt_add_library( NAME cajitafluids +blt_add_library( NAME cabanafluids HEADERS ${HEADERS} SOURCES ${SOURCES} INCLUDES ${INCLUDES} diff --git a/src/InflowSource.hpp b/src/InflowSource.hpp index f7af95d..8765de9 100644 --- a/src/InflowSource.hpp +++ b/src/InflowSource.hpp @@ -3,22 +3,24 @@ * @author Patrick Bridges * * @section DESCRIPTION - * Inflow Sources Conditions for CajitaFluids + * Inflow Sources Conditions for CabanaFluids */ -#ifndef CAJITAFLUIDS_INFLOWSOURCE_HPP -#define CAJITAFLUIDS_INFLOWSOURCE_HPP +#ifndef CABANAFLUIDS_INFLOWSOURCE_HPP +#define CABANAFLUIDS_INFLOWSOURCE_HPP #ifndef DEBUG #define DEBUG 0 #endif // Include Statements -#include - +#include +#include #include -namespace CajitaFluids +#include + +namespace CabanaFluids { /** * @struct InflowSource @@ -31,8 +33,8 @@ template <> struct InflowSource<2> { template - KOKKOS_INLINE_FUNCTION void operator()( Cajita::Cell, ArrayType& q, int i, - int j, double x, double y, + KOKKOS_INLINE_FUNCTION void operator()( Cabana::Grid::Cell, ArrayType& q, + int i, int j, double x, double y, [[maybe_unused]] double delta_t, [[maybe_unused]] double v ) const { @@ -51,8 +53,8 @@ struct InflowSource<2> template KOKKOS_INLINE_FUNCTION void - operator()( Cajita::Face, ArrayType& ux, int i, int j, - double x, double y, [[maybe_unused]] double delta_t, + operator()( Cabana::Grid::Face, ArrayType& ux, int i, + int j, double x, double y, [[maybe_unused]] double delta_t, [[maybe_unused]] double v ) const { if ( x >= _bounding_box[0] && x < _bounding_box[2] && @@ -65,8 +67,8 @@ struct InflowSource<2> template KOKKOS_INLINE_FUNCTION void - operator()( Cajita::Face, ArrayType& uy, int i, int j, - double x, double y, [[maybe_unused]] double delta_t, + operator()( Cabana::Grid::Face, ArrayType& uy, int i, + int j, double x, double y, [[maybe_unused]] double delta_t, [[maybe_unused]] double v ) const { if ( x >= _bounding_box[0] && x < _bounding_box[2] && @@ -97,6 +99,6 @@ struct InflowSource<2> to force at location*/ }; -} // namespace CajitaFluids +} // namespace CabanaFluids #endif diff --git a/src/Interpolation.hpp b/src/Interpolation.hpp index a24d920..bb3dd09 100644 --- a/src/Interpolation.hpp +++ b/src/Interpolation.hpp @@ -1,30 +1,31 @@ /**************************************************************************** - * Copyright (c) 2022 by the CajitaFluids authors * + * Copyright (c) 2022 by the CabanaFluids authors * * All rights reserved. * * * - * This file is part of the CajitaFluids library. CajitaFluids is * + * This file is part of the CabanaFluids library. CabanaFluids is * * distributed under a BSD 3-clause license. For the licensing terms see * * the LICENSE file in the top-level directory. * * * * SPDX-License-Identifier: BSD-3-Clause * ****************************************************************************/ -#ifndef CAJITAFLUIDS_INTERPOLATION_HPP -#define CAJITAFLUIDS_INTERPOLATION_HPP - -#include -#include +#ifndef CABANAFLUIDS_INTERPOLATION_HPP +#define CABANAFLUIDS_INTERPOLATION_HPP +#include +#include #include -namespace CajitaFluids +#include + +namespace CabanaFluids { namespace Interpolation { -using Cell = Cajita::Cell; -using FaceI = Cajita::Face; -using FaceJ = Cajita::Face; -using FaceK = Cajita::Face; +using Cell = Cabana::Grid::Cell; +using FaceI = Cabana::Grid::Face; +using FaceJ = Cabana::Grid::Face; +using FaceK = Cabana::Grid::Face; // Spline to interpolate values for advection. template spline; - Cajita::evaluateSpline( local_mesh, loc, spline ); - Cajita::G2P::value( field, spline, value ); + Cabana::Grid::SplineData spline; + Cabana::Grid::evaluateSpline( local_mesh, loc, spline ); + Cabana::Grid::G2P::value( field, spline, value ); return value; } @@ -54,6 +55,6 @@ KOKKOS_INLINE_FUNCTION void interpolateVelocity( const double loc[NumSpaceDims], } } // end namespace Interpolation -} // end namespace CajitaFluids +} // end namespace CabanaFluids #endif // end CAJITAFLUIDS_INTERPOLATION_HPP diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 7cbf2ce..ae64555 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -1,8 +1,8 @@ /**************************************************************************** - * Copyright (c) 2021 by the CajitaFluids authors * + * Copyright (c) 2021 by the CabanaFluids authors * * All rights reserved. * * * - * This file is part of the CajitaFluids benchmark. CajitaFluids is * + * This file is part of the CabanaFluids benchmark. CabanaFluids is * * distributed under a BSD 3-clause license. For the licensing terms see * * the LICENSE file in the top-level directory. * * * @@ -11,7 +11,7 @@ #include -namespace CajitaFluids +namespace CabanaFluids { //---------------------------------------------------------------------------// #ifdef KOKKOS_ENABLE_CUDA @@ -22,4 +22,4 @@ template class Mesh<2, Kokkos::DefaultHostExecutionSpace, Kokkos::HostSpace>; //---------------------------------------------------------------------------// -} // end namespace CajitaFluids +} // end namespace CabanaFluids diff --git a/src/Mesh.hpp b/src/Mesh.hpp index b61c8b2..d50daf4 100644 --- a/src/Mesh.hpp +++ b/src/Mesh.hpp @@ -1,28 +1,30 @@ /**************************************************************************** - * Copyright (c) 2021 by the CajitaFluids authors * + * Copyright (c) 2021 by the CabanaFluids authors * * All rights reserved. * * * - * This file is part of the CajitaFluids benchmark. CajitaFluids is * + * This file is part of the CabanaFluids benchmark. CabanaFluids is * * distributed under a BSD 3-clause license. For the licensing terms see * * the LICENSE file in the top-level directory. * * * * SPDX-License-Identifier: BSD-3-Clause * ****************************************************************************/ -#ifndef CAJITAFLUIDS_MESH_HPP -#define CAJITAFLUIDS_MESH_HPP - -#include +#ifndef CABANAFLUIDS_MESH_HPP +#define CABANAFLUIDS_MESH_HPP +#include +#include #include +#include + #include #include #include -namespace CajitaFluids +namespace CabanaFluids { //---------------------------------------------------------------------------// /*! @@ -34,13 +36,13 @@ class Mesh { public: using memory_space = MemorySpace; - using device_type = Kokkos::Device; - using mesh_type = Cajita::UniformMesh; + // using device_type = Kokkos::Device; + using mesh_type = Cabana::Grid::UniformMesh; // Construct a mesh. Mesh( const Kokkos::Array& global_bounding_box, const std::array& global_num_cell, - const Cajita::BlockPartitioner& partitioner, + const Cabana::Grid::BlockPartitioner& partitioner, const int halo_cell_width, MPI_Comm comm ) { // Make a copy of the global number of cells so we can modify it. @@ -78,7 +80,7 @@ class Mesh } // Create the global mesh. - auto global_mesh = Cajita::createUniformGlobalMesh( + auto global_mesh = Cabana::Grid::createUniformGlobalMesh( global_low_corner, global_high_corner, num_cell ); // Build the global grid. @@ -86,30 +88,31 @@ class Mesh for ( int i = 0; i < Dim; i++ ) periodic[i] = false; - auto global_grid = Cajita::createGlobalGrid( comm, global_mesh, - periodic, partitioner ); + auto global_grid = Cabana::Grid::createGlobalGrid( + comm, global_mesh, periodic, partitioner ); // Build the local grid. int halo_width = halo_cell_width; - _local_grid = Cajita::createLocalGrid( global_grid, halo_width ); + _local_grid = Cabana::Grid::createLocalGrid( global_grid, halo_width ); // Build the local mesh. XXX Why is this hard to share? Is it expensive? - auto local_mesh = Cajita::createLocalMesh( *_local_grid ); + auto local_mesh = + Cabana::Grid::createLocalMesh( *_local_grid ); _local_mesh = - std::make_shared>( + std::make_shared>( local_mesh ); MPI_Comm_rank( comm, &_rank ); } // Get the local grid. - const std::shared_ptr>& localGrid() const + const std::shared_ptr>& localGrid() const { return _local_grid; } // Get the local mesh. - const std::shared_ptr>& + const std::shared_ptr>& localMesh() const { return _local_mesh; @@ -136,8 +139,9 @@ class Mesh int rank() const { return _rank; } public: - std::shared_ptr> _local_grid; - std::shared_ptr> _local_mesh; + std::shared_ptr> _local_grid; + std::shared_ptr> + _local_mesh; Kokkos::Array _min_domain_global_cell_index; Kokkos::Array _max_domain_global_cell_index; @@ -146,6 +150,6 @@ class Mesh //---------------------------------------------------------------------------// -} // end namespace CajitaFluids +} // end namespace CabanaFluids #endif // end CAJITAFLUIDS_MESH_HPP diff --git a/src/ProblemManager.cpp b/src/ProblemManager.cpp index bb664ed..c26172a 100644 --- a/src/ProblemManager.cpp +++ b/src/ProblemManager.cpp @@ -1,8 +1,8 @@ /**************************************************************************** - * Copyright (c) 2018-2020 by the CajitaFluids authors * + * Copyright (c) 2018-2020 by the CabanaFluids authors * * All rights reserved. * * * - * This file is part of the CajitaFluids benchmark. CajitaFluids is * + * This file is part of the CabanaFluids benchmark. CabanaFluids is * * distributed under a BSD 3-clause license. For the licensing terms see * * the LICENSE file in the top-level directory. * * * @@ -12,7 +12,7 @@ #include #include -namespace CajitaFluids +namespace CabanaFluids { //---------------------------------------------------------------------------// template class ProblemManager<2, Kokkos::DefaultHostExecutionSpace, @@ -20,4 +20,4 @@ template class ProblemManager<2, Kokkos::DefaultHostExecutionSpace, //---------------------------------------------------------------------------// -} // end namespace CajitaFluids +} // end namespace CabanaFluids diff --git a/src/ProblemManager.hpp b/src/ProblemManager.hpp index e426a08..90f3b09 100644 --- a/src/ProblemManager.hpp +++ b/src/ProblemManager.hpp @@ -8,8 +8,8 @@ * scatters and gathers */ -#ifndef CAJITAFLUIDS_PROBLEMMANAGER_HPP -#define CAJITAFLUIDS_PROBLEMMANAGER_HPP +#ifndef CABANAFLUIDS_PROBLEMMANAGER_HPP +#define CABANAFLUIDS_PROBLEMMANAGER_HPP #ifndef DEBUG #define DEBUG 0 @@ -17,14 +17,14 @@ // Include Statements #include -#include +#include #include #include #include -namespace CajitaFluids +namespace CabanaFluids { /** @@ -100,28 +100,27 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> public: using memory_space = MemorySpace; using execution_space = ExecutionSpace; - using device_type = Kokkos::Device; - using Cell = Cajita::Cell; - using FaceI = Cajita::Face; - using FaceJ = Cajita::Face; - using FaceK = Cajita::Face; + using Cell = Cabana::Grid::Cell; + using FaceI = Cabana::Grid::Face; + using FaceJ = Cabana::Grid::Face; + using FaceK = Cabana::Grid::Face; using cell_array = - Cajita::Array, - MemorySpace>; + Cabana::Grid::Array, MemorySpace>; using iface_array = - Cajita::Array, - Cajita::UniformMesh, MemorySpace>; + Cabana::Grid::Array, + Cabana::Grid::UniformMesh, MemorySpace>; using jface_array = - Cajita::Array, - Cajita::UniformMesh, MemorySpace>; + Cabana::Grid::Array, + Cabana::Grid::UniformMesh, MemorySpace>; // Meaningless type for now until we have 3D support in. using kface_array = - Cajita::Array, - Cajita::UniformMesh, MemorySpace>; - using halo_type = Cajita::Halo; + Cabana::Grid::Array, + Cabana::Grid::UniformMesh, MemorySpace>; + using halo_type = Cabana::Grid::Halo; using mesh_type = Mesh<2, ExecutionSpace, MemorySpace>; template @@ -133,36 +132,38 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> // The layouts of our various arrays for values on the staggered mesh // and other associated data strutures. Do there need to be version with // halos associuated with them? - auto iface_scalar_layout = Cajita::createArrayLayout( - _mesh->localGrid(), 1, Cajita::Face() ); - auto jface_scalar_layout = Cajita::createArrayLayout( - _mesh->localGrid(), 1, Cajita::Face() ); - auto cell_scalar_layout = - Cajita::createArrayLayout( _mesh->localGrid(), 1, Cajita::Cell() ); + auto iface_scalar_layout = Cabana::Grid::createArrayLayout( + _mesh->localGrid(), 1, Cabana::Grid::Face() ); + auto jface_scalar_layout = Cabana::Grid::createArrayLayout( + _mesh->localGrid(), 1, Cabana::Grid::Face() ); + auto cell_scalar_layout = Cabana::Grid::createArrayLayout( + _mesh->localGrid(), 1, Cabana::Grid::Cell() ); // The actual arrays storing mesh quantities // 1. The quantity of the scalar quantity being advected - _quantity_curr = Cajita::createArray( + _quantity_curr = Cabana::Grid::createArray( "quantity", cell_scalar_layout ); - _quantity_next = Cajita::createArray( + _quantity_next = Cabana::Grid::createArray( "quantity", cell_scalar_layout ); - Cajita::ArrayOp::assign( *_quantity_curr, 0.0, Cajita::Ghost() ); - Cajita::ArrayOp::assign( *_quantity_next, 0.0, Cajita::Ghost() ); + Cabana::Grid::ArrayOp::assign( *_quantity_curr, 0.0, + Cabana::Grid::Ghost() ); + Cabana::Grid::ArrayOp::assign( *_quantity_next, 0.0, + Cabana::Grid::Ghost() ); // 2. The magnitudes of the velocities normal to the cell faces - _u_curr = Cajita::createArray( + _u_curr = Cabana::Grid::createArray( "u0", iface_scalar_layout ); - _u_next = Cajita::createArray( + _u_next = Cabana::Grid::createArray( "u1", iface_scalar_layout ); - Cajita::ArrayOp::assign( *_u_curr, 0.0, Cajita::Ghost() ); - Cajita::ArrayOp::assign( *_u_next, 0.0, Cajita::Ghost() ); + Cabana::Grid::ArrayOp::assign( *_u_curr, 0.0, Cabana::Grid::Ghost() ); + Cabana::Grid::ArrayOp::assign( *_u_next, 0.0, Cabana::Grid::Ghost() ); - _v_curr = Cajita::createArray( + _v_curr = Cabana::Grid::createArray( "v0", jface_scalar_layout ); - _v_next = Cajita::createArray( + _v_next = Cabana::Grid::createArray( "v1", jface_scalar_layout ); - Cajita::ArrayOp::assign( *_v_curr, 0.0, Cajita::Ghost() ); - Cajita::ArrayOp::assign( *_v_next, 0.0, Cajita::Ghost() ); + Cabana::Grid::ArrayOp::assign( *_v_curr, 0.0, Cabana::Grid::Ghost() ); + Cabana::Grid::ArrayOp::assign( *_v_next, 0.0, Cabana::Grid::Ghost() ); // Halo patterns for the velocity and quantity advection. These halos // are are three cells deep because: We only allow quantities to advect @@ -171,9 +172,9 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> // with a 3rd-order polynomial which could reach two additional cells // outside our boundary. int halo_depth = _mesh->localGrid()->haloCellWidth(); - _advection_halo = - Cajita::createHalo( Cajita::NodeHaloPattern<2>(), halo_depth, - *_quantity_curr, *_u_curr, *_v_curr ); + _advection_halo = Cabana::Grid::createHalo( + Cabana::Grid::NodeHaloPattern<2>(), halo_depth, *_quantity_curr, + *_u_curr, *_v_curr ); // Initialize State Values ( quantity and velocity ) initialize( create_functor ); @@ -196,17 +197,18 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> double cell_size = _mesh->cellSize(); // Get State Arrays - auto q = get( Cajita::Cell(), Field::Quantity(), Version::Current() ); + auto q = + get( Cabana::Grid::Cell(), Field::Quantity(), Version::Current() ); // Loop Over All Owned Cells ( i, j ) - auto own_cells = local_grid.indexSpace( Cajita::Own(), Cajita::Cell(), - Cajita::Local() ); + auto own_cells = local_grid.indexSpace( + Cabana::Grid::Own(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); int index[2] = { 0, 0 }; double loc[2]; // x/y loocation of the cell at 0, 0 - local_mesh.coordinates( Cajita::Cell(), index, loc ); + local_mesh.coordinates( Cabana::Grid::Cell(), index, loc ); Kokkos::parallel_for( "Initialize Cells`", - Cajita::createExecutionPolicy( own_cells, ExecutionSpace() ), + Cabana::Grid::createExecutionPolicy( own_cells, ExecutionSpace() ), KOKKOS_LAMBDA( const int i, const int j ) { // Get Coordinates Associated with Indices ( i, j, k ) int coords[2] = { i, j }; @@ -214,19 +216,21 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> x[0] = loc[0] + cell_size * i; x[1] = loc[1] + cell_size * j; // Initialization Function - create_functor( Cajita::Cell(), Field::Quantity(), coords, x, - q( i, j, 0 ) ); + create_functor( Cabana::Grid::Cell(), Field::Quantity(), coords, + x, q( i, j, 0 ) ); } ); // Loop Over All Owned I-Faces ( i, j ) auto own_faces = local_grid.indexSpace( - Cajita::Own(), Cajita::Face(), Cajita::Local() ); - auto u = get( Cajita::Face(), Field::Velocity(), - Version::Current() ); - local_mesh.coordinates( Cajita::Face(), index, loc ); + Cabana::Grid::Own(), Cabana::Grid::Face(), + Cabana::Grid::Local() ); + auto u = get( Cabana::Grid::Face(), + Field::Velocity(), Version::Current() ); + local_mesh.coordinates( Cabana::Grid::Face(), + index, loc ); Kokkos::parallel_for( "Initialize I-Faces", - Cajita::createExecutionPolicy( own_faces, ExecutionSpace() ), + Cabana::Grid::createExecutionPolicy( own_faces, ExecutionSpace() ), KOKKOS_LAMBDA( const int i, const int j ) { // Get Coordinates Associated with Indices ( i, j ) int coords[2] = { i, j }; @@ -235,19 +239,21 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> x[1] = loc[1] + cell_size * j; // Initialization Function - create_functor( Cajita::Face(), + create_functor( Cabana::Grid::Face(), Field::Velocity(), coords, x, u( i, j, 0 ) ); } ); // Loop Over All Owned J-Faces ( i, j ) own_faces = local_grid.indexSpace( - Cajita::Own(), Cajita::Face(), Cajita::Local() ); - auto v = get( Cajita::Face(), Field::Velocity(), - Version::Current() ); - local_mesh.coordinates( Cajita::Face(), index, loc ); + Cabana::Grid::Own(), Cabana::Grid::Face(), + Cabana::Grid::Local() ); + auto v = get( Cabana::Grid::Face(), + Field::Velocity(), Version::Current() ); + local_mesh.coordinates( Cabana::Grid::Face(), + index, loc ); Kokkos::parallel_for( "Initialize J-Faces", - Cajita::createExecutionPolicy( own_faces, ExecutionSpace() ), + Cabana::Grid::createExecutionPolicy( own_faces, ExecutionSpace() ), KOKKOS_LAMBDA( const int i, const int j ) { // Get Coordinates Associated with Indices ( i, j ) int coords[2] = { i, j }; @@ -257,7 +263,7 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> x[1] = loc[1] + cell_size * j; // Initialization Function - create_functor( Cajita::Face(), + create_functor( Cabana::Grid::Face(), Field::Velocity(), coords, x, v( i, j, 0 ) ); } ); }; @@ -278,7 +284,7 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> * @param Version::Current * @return Returns view of current advected quantity at cell centers **/ - typename cell_array::view_type get( Cajita::Cell, Field::Quantity, + typename cell_array::view_type get( Cabana::Grid::Cell, Field::Quantity, Version::Current ) const { return _quantity_curr->view(); @@ -291,7 +297,7 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> * @param Version::Next * @return Returns view of next advected quantity at cell centers **/ - typename cell_array::view_type get( Cajita::Cell, Field::Quantity, + typename cell_array::view_type get( Cabana::Grid::Cell, Field::Quantity, Version::Next ) const { return _quantity_next->view(); @@ -305,7 +311,8 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> * @return Returns view of current norm velocity magnitude on i faces **/ typename cell_array::view_type - get( Cajita::Face, Field::Velocity, Version::Current ) const + get( Cabana::Grid::Face, Field::Velocity, + Version::Current ) const { return _u_curr->view(); }; @@ -317,8 +324,9 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> * @param Version::Next * @return Returns view of next norm velocity magnitude on i faces **/ - typename cell_array::view_type get( Cajita::Face, - Field::Velocity, Version::Next ) const + typename cell_array::view_type + get( Cabana::Grid::Face, Field::Velocity, + Version::Next ) const { return _u_next->view(); }; @@ -331,7 +339,8 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> * @return Returns view of current norm velocity magnitude on j faces **/ typename cell_array::view_type - get( Cajita::Face, Field::Velocity, Version::Current ) const + get( Cabana::Grid::Face, Field::Velocity, + Version::Current ) const { return _v_curr->view(); }; @@ -343,38 +352,39 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> * @param Version::Next * @return Returns view of next norm velocity magnitude on j faces **/ - typename cell_array::view_type get( Cajita::Face, - Field::Velocity, Version::Next ) const + typename cell_array::view_type + get( Cabana::Grid::Face, Field::Velocity, + Version::Next ) const { return _v_next->view(); }; /** * Make the next version of a field the current one - * @param Cajita::Cell + * @param Cabana::Grid::Cell * @param Field::Quantity **/ - void advance( Cajita::Cell, Field::Quantity ) + void advance( Cabana::Grid::Cell, Field::Quantity ) { _quantity_curr.swap( _quantity_next ); } /** * Make the next version of a field the current one - * @param Cajita::Face + * @param Cabana::Grid::Face * @param Field::Velocity **/ - void advance( Cajita::Face, Field::Velocity ) + void advance( Cabana::Grid::Face, Field::Velocity ) { _u_curr.swap( _u_next ); } /** * Make the next version of a field the current one - * @param Cajita::Face + * @param Cabana::Grid::Face * @param Field::Velocity **/ - void advance( Cajita::Face, Field::Velocity ) + void advance( Cabana::Grid::Face, Field::Velocity ) { _v_curr.swap( _v_next ); } @@ -417,6 +427,6 @@ class ProblemManager<2, ExecutionSpace, MemorySpace> // std::shared_ptr _cell_pressure_halo; }; -} // namespace CajitaFluids +} // namespace CabanaFluids -#endif // CAJITAFLUIDS_PROBLEMMANAGER_HPP +#endif // CABANAFLUIDS_PROBLEMMANAGER_HPP diff --git a/src/SiloWriter.hpp b/src/SiloWriter.hpp index 1345963..11f5383 100644 --- a/src/SiloWriter.hpp +++ b/src/SiloWriter.hpp @@ -7,21 +7,23 @@ * Silo Writer class to write results to a silo file using PMPIO */ -#ifndef CAJITAFLUIDS_SILOWRITER_HPP -#define CAJITAFLUIDS_SILOWRITER_HPP +#ifndef CABANAFLUIDS_SILOWRITER_HPP +#define CABANAFLUIDS_SILOWRITER_HPP #ifndef DEBUG #define DEBUG 0 #endif // Include Statements -#include +#include +#include #include +#include #include #include -namespace CajitaFluids +namespace CabanaFluids { /** @@ -34,7 +36,6 @@ class SiloWriter { public: using pm_type = ProblemManager; - using device_type = Kokkos::Device; /** * Constructor * Create new SiloWriter @@ -46,7 +47,7 @@ class SiloWriter : _pm( pm ) { if ( DEBUG && _pm->mesh()->rank() == 0 ) - std::cerr << "Created CajitaFluids SiloWriter\n"; + std::cerr << "Created CabanaFluids SiloWriter\n"; }; /** @@ -90,7 +91,7 @@ class SiloWriter // coordinates of the portion of the mesh we're writing Kokkos::Profiling::pushRegion( "SiloWriter::WriteFile::WriteMesh" ); auto cell_domain = local_grid->indexSpace( - Cajita::Own(), Cajita::Cell(), Cajita::Local() ); + Cabana::Grid::Own(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); for ( unsigned int i = 0; i < Dims; i++ ) { @@ -117,7 +118,7 @@ class SiloWriter for ( unsigned int j = 0; j < Dims; j++ ) index[j] = 0; index[d] = i; - local_mesh.coordinates( Cajita::Node(), index, location ); + local_mesh.coordinates( Cabana::Grid::Node(), index, location ); coords[d][iown] = location[d]; } } @@ -133,8 +134,8 @@ class SiloWriter // Advected quantity first - copy owned portion from the primary // execution space to the host execution space Kokkos::Profiling::pushRegion( "SiloWriter::WriteFile::WriteQuantity" ); - auto q = - _pm->get( Cajita::Cell(), Field::Quantity(), Version::Current() ); + auto q = _pm->get( Cabana::Grid::Cell(), Field::Quantity(), + Version::Current() ); auto xmin = cell_domain.min( 0 ); auto ymin = cell_domain.min( 1 ); @@ -143,7 +144,7 @@ class SiloWriter // XXX WHY DOES THIS ONLY WORK LAYOUTLEFT? Kokkos::View + typename pm_type::cell_array::memory_space> qOwned( "qowned", cell_domain.extent( 0 ), cell_domain.extent( 1 ), 1 ); Kokkos::parallel_for( @@ -160,10 +161,10 @@ class SiloWriter Kokkos::Profiling::popRegion(); Kokkos::Profiling::pushRegion( "SiloWriter::WriteFile::WriteVelocity" ); - auto u = _pm->get( Cajita::Face(), Field::Velocity(), - Version::Current() ); - auto v = _pm->get( Cajita::Face(), Field::Velocity(), - Version::Current() ); + auto u = _pm->get( Cabana::Grid::Face(), + Field::Velocity(), Version::Current() ); + auto v = _pm->get( Cabana::Grid::Face(), + Field::Velocity(), Version::Current() ); /* Because VisIt and all the other things that read Silo files * can't currently show edge velocity magnitudes, we @@ -171,12 +172,12 @@ class SiloWriter // XXX Why does this only work LayoutLeft??? Kokkos::View + typename pm_type::cell_array::memory_space> uOwned( "uOwned", cell_domain.extent( 0 ), cell_domain.extent( 1 ), 1 ); Kokkos::View + typename pm_type::cell_array::memory_space> vOwned( "vOwned", cell_domain.extent( 0 ), cell_domain.extent( 1 ), 1 ); Kokkos::parallel_for( @@ -185,7 +186,7 @@ class SiloWriter KOKKOS_LAMBDA( const int i, const int j ) { int idx[2] = { i, j }; double loc[2], velocity[2]; - local_mesh.coordinates( Cajita::Cell(), idx, loc ); + local_mesh.coordinates( Cabana::Grid::Cell(), idx, loc ); Interpolation::interpolateVelocity<2, 1>( loc, local_mesh, u, v, velocity ); uOwned( i - xmin, j - ymin, 0 ) = velocity[0]; @@ -227,7 +228,7 @@ class SiloWriter Kokkos::Profiling::pushRegion( "SiloWriter::CreateSiloFile" ); DBfile* silo_file = DBCreate( filename, DB_CLOBBER, DB_LOCAL, - "CajitaFluidsRaw", driver ); + "CabanaFluidsRaw", driver ); if ( silo_file ) { @@ -313,13 +314,13 @@ class SiloWriter v_block_names[i] = (char*)malloc( 1024 ); sprintf( mesh_block_names[i], - "raw/CajitaFluidsOutput%05d%05d.%s:/domain_%05d/Mesh", + "raw/CabanaFluidsOutput%05d%05d.%s:/domain_%05d/Mesh", group_rank, time_step, file_ext, i ); sprintf( q_block_names[i], - "raw/CajitaFluidsOutput%05d%05d.%s:/domain_%05d/quantity", + "raw/CabanaFluidsOutput%05d%05d.%s:/domain_%05d/quantity", group_rank, time_step, file_ext, i ); sprintf( v_block_names[i], - "raw/CajitaFluidsOutput%05d%05d.%s:/domain_%05d/velocity", + "raw/CabanaFluidsOutput%05d%05d.%s:/domain_%05d/velocity", group_rank, time_step, file_ext, i ); block_types[i] = DB_QUADMESH; var_types[i] = DB_QUADVAR; @@ -380,9 +381,9 @@ class SiloWriter createSiloFile, openSiloFile, closeSiloFile, &driver ); // Set Filename to Reflect TimeStep - sprintf( masterfilename, "data/CajitaFluids%05d.%s", time_step, + sprintf( masterfilename, "data/CabanaFluids%05d.%s", time_step, file_ext ); - sprintf( filename, "data/raw/CajitaFluidsOutput%05d%05d.%s", + sprintf( filename, "data/raw/CabanaFluidsOutput%05d%05d.%s", PMPIO_GroupRank( baton, _pm->mesh()->rank() ), time_step, file_ext ); sprintf( nsname, "domain_%05d", _pm->mesh()->rank() ); @@ -400,7 +401,7 @@ class SiloWriter if ( _pm->mesh()->rank() == 0 ) { master_file = DBCreate( masterfilename, DB_CLOBBER, DB_LOCAL, - "CajitaFluids", driver ); + "CabanaFluids", driver ); writeMultiObjects( master_file, baton, size, time_step, "pdb" ); DBClose( master_file ); } @@ -421,5 +422,5 @@ class SiloWriter std::shared_ptr _pm; }; -}; // namespace CajitaFluids +}; // namespace CabanaFluids #endif diff --git a/src/Solver.hpp b/src/Solver.hpp index 74c6def..d859a91 100644 --- a/src/Solver.hpp +++ b/src/Solver.hpp @@ -1,21 +1,20 @@ /**************************************************************************** - * Copyright (c) 2018-2020 by the CajitaFluids authors * + * Copyright (c) 2018-2020 by the CabanaFluids authors * * All rights reserved. * * * - * This file is part of the CajitaFluids library. CajitaFluids is * + * This file is part of the CabanaFluids library. CabanaFluids is * * distributed under a BSD 3-clause license. For the licensing terms see * * the LICENSE file in the top-level directory. * * * * SPDX-License-Identifier: BSD-3-Clause * ****************************************************************************/ -#ifndef CAJITAFLUIDS_SOLVER_HPP -#define CAJITAFLUIDS_SOLVER_HPP +#ifndef CABANAFLUIDS_SOLVER_HPP +#define CABANAFLUIDS_SOLVER_HPP -#include -#include -#include -#include +#include +#include +#include #include #include @@ -32,7 +31,7 @@ #include -namespace CajitaFluids +namespace CabanaFluids { /* * Convenience base class so that examples that use this don't need to know @@ -56,20 +55,20 @@ class Solver<2, ExecutionSpace, MemorySpace> : public SolverBase { public: using device_type = Kokkos::Device; - using mesh_type = Cajita::UniformMesh; + using mesh_type = Cabana::Grid::UniformMesh; using cell_array = - Cajita::Array; + Cabana::Grid::Array; using pm_type = ProblemManager<2, ExecutionSpace, MemorySpace>; using bc_type = BoundaryCondition<2>; - using Cell = Cajita::Cell; - using FaceI = Cajita::Face; - using FaceJ = Cajita::Face; + using Cell = Cabana::Grid::Cell; + using FaceI = Cabana::Grid::Face; + using FaceJ = Cabana::Grid::Face; template Solver( MPI_Comm comm, const Kokkos::Array& global_bounding_box, const std::array& global_num_cell, - const Cajita::BlockPartitioner<2>& partitioner, + const Cabana::Grid::BlockPartitioner<2>& partitioner, const double density, const InitFunc& create_functor, const BoundaryCondition<2>& bc, const InflowSource<2>& source, const BodyForce<2>& body, const double delta_t, @@ -186,8 +185,8 @@ class Solver<2, ExecutionSpace, MemorySpace> : public SolverBase double cell_size = _mesh->cellSize(); double cell_area = cell_size * cell_size; - auto owned_cells = local_grid.indexSpace( Cajita::Own(), Cajita::Cell(), - Cajita::Local() ); + auto owned_cells = local_grid.indexSpace( + Cabana::Grid::Own(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); // Create local variable versions of the class members to avoid needing // to use a (potentially expensive) class lambda @@ -208,19 +207,19 @@ class Solver<2, ExecutionSpace, MemorySpace> : public SolverBase local_mesh.coordinates( Cell(), idx, loc ); double x = loc[0], y = loc[1]; - source( Cajita::Cell(), quantity, i, j, x, y, delta_t, + source( Cabana::Grid::Cell(), quantity, i, j, x, y, delta_t, cell_area ); - body( Cajita::Cell(), quantity, i, j, x, y, delta_t, + body( Cabana::Grid::Cell(), quantity, i, j, x, y, delta_t, cell_area ); } ); Kokkos::Profiling::popRegion(); Kokkos::Profiling::pushRegion( "Solve::AddInputs::FaceI" ); - auto owned_ifaces = - local_grid.indexSpace( Cajita::Own(), FaceI(), Cajita::Local() ); + auto owned_ifaces = local_grid.indexSpace( Cabana::Grid::Own(), FaceI(), + Cabana::Grid::Local() ); auto ui = _pm->get( FaceI(), Field::Velocity(), Version::Current() ); auto l2g_facei = - Cajita::IndexConversion::createL2G( local_grid, FaceI() ); + Cabana::Grid::IndexConversion::createL2G( local_grid, FaceI() ); Kokkos::parallel_for( "add external x velocity", @@ -240,11 +239,11 @@ class Solver<2, ExecutionSpace, MemorySpace> : public SolverBase Kokkos::Profiling::popRegion(); Kokkos::Profiling::pushRegion( "Solve::AddInputs::FaceJ" ); - auto owned_jfaces = - local_grid.indexSpace( Cajita::Own(), FaceJ(), Cajita::Local() ); + auto owned_jfaces = local_grid.indexSpace( Cabana::Grid::Own(), FaceJ(), + Cabana::Grid::Local() ); auto uj = _pm->get( FaceJ(), Field::Velocity(), Version::Current() ); auto l2g_facej = - Cajita::IndexConversion::createL2G( local_grid, FaceJ() ); + Cabana::Grid::IndexConversion::createL2G( local_grid, FaceJ() ); Kokkos::parallel_for( "add external y velocity", createExecutionPolicy( owned_jfaces, ExecutionSpace() ), @@ -286,7 +285,7 @@ std::shared_ptr createSolver( const std::string& device, MPI_Comm comm, const Kokkos::Array& global_bounding_box, const std::array& global_num_cell, - const Cajita::BlockPartitioner<2>& partitioner, + const Cabana::Grid::BlockPartitioner<2>& partitioner, const double density, const InitFunc& create_functor, const BoundaryCondition<2>& bc, const InflowSource<2>& source, const BodyForce<2>& body, const double delta_t, @@ -299,7 +298,7 @@ createSolver( const std::string& device, MPI_Comm comm, // to set it up to use a different solver in that case #if defined( KOKKOS_ENABLE_SERIAL ) && !defined( KOKKOS_ENABLE_CUDA ) return std::make_shared< - CajitaFluids::Solver<2, Kokkos::Serial, Kokkos::HostSpace>>( + CabanaFluids::Solver<2, Kokkos::Serial, Kokkos::HostSpace>>( comm, global_bounding_box, global_num_cell, partitioner, density, create_functor, bc, source, body, delta_t, matrix_solver, preconditioner ); @@ -311,7 +310,7 @@ createSolver( const std::string& device, MPI_Comm comm, { #if defined( KOKKOS_ENABLE_OPENMP ) && !defined( KOKKOS_ENABLE_CUDA ) return std::make_shared< - CajitaFluids::Solver<2, Kokkos::OpenMP, Kokkos::HostSpace>>( + CabanaFluids::Solver<2, Kokkos::OpenMP, Kokkos::HostSpace>>( comm, global_bounding_box, global_num_cell, partitioner, density, create_functor, bc, source, body, delta_t, matrix_solver, preconditioner ); @@ -323,7 +322,7 @@ createSolver( const std::string& device, MPI_Comm comm, { #ifdef KOKKOS_ENABLE_CUDA return std::make_shared< - CajitaFluids::Solver<2, Kokkos::Cuda, Kokkos::CudaSpace>>( + CabanaFluids::Solver<2, Kokkos::Cuda, Kokkos::CudaSpace>>( comm, global_bounding_box, global_num_cell, partitioner, density, create_functor, bc, source, body, delta_t, matrix_solver, preconditioner ); @@ -334,7 +333,7 @@ createSolver( const std::string& device, MPI_Comm comm, else if ( 0 == device.compare( "hip" ) ) { #ifdef KOKKOS_ENABLE_HIP - return std::make_shared>( comm, global_bounding_box, global_num_cell, partitioner, density, create_functor, bc, source, body, delta_t, matrix_solver, @@ -352,6 +351,6 @@ createSolver( const std::string& device, MPI_Comm comm, //---------------------------------------------------------------------------// -} // end namespace CajitaFluids +} // end namespace CabanaFluids -#endif // end CAJITAFLUIDS_SOLVER_HPP +#endif // end CABANAFLUIDS_SOLVER_HPP diff --git a/src/TimeIntegrator.hpp b/src/TimeIntegrator.hpp index 00409e8..906fd5b 100644 --- a/src/TimeIntegrator.hpp +++ b/src/TimeIntegrator.hpp @@ -1,26 +1,27 @@ /**************************************************************************** - * Copyright (c) 2022 by the CajitaFluids authors * + * Copyright (c) 2022 by the CabanaFluids authors * * All rights reserved. * * * - * This file is part of the CajitaFluids library. CajitaFluids is * + * This file is part of the CabanaFluids library. CabanaFluids is * * distributed under a BSD 3-clause license. For the licensing terms see * * the LICENSE file in the top-level directory. * * * * SPDX-License-Identifier: BSD-3-Clause * ****************************************************************************/ -#ifndef CAJITAFLUIDS_TIMEINTEGRATOR_HPP -#define CAJITAFLUIDS_TIMEINTEGRATOR_HPP +#ifndef CABANAFLUIDS_TIMEINTEGRATOR_HPP +#define CABANAFLUIDS_TIMEINTEGRATOR_HPP + +#include +#include +#include #include #include +#include #include -#include - -#include - -namespace CajitaFluids +namespace CabanaFluids { // These routines use state in other classes and don't need state themselves, @@ -28,10 +29,10 @@ namespace CajitaFluids namespace TimeIntegrator { -using Cell = Cajita::Cell; -using FaceI = Cajita::Face; -using FaceJ = Cajita::Face; -using FaceK = Cajita::Face; +using Cell = Cabana::Grid::Cell; +using FaceI = Cabana::Grid::Face; +using FaceJ = Cabana::Grid::Face; +using FaceK = Cabana::Grid::Face; template KOKKOS_FUNCTION void @@ -94,8 +95,8 @@ void advect( ExecutionSpace& exec_space, ProblemManagerType& pm, double delta_t, auto local_grid = pm.mesh()->localGrid(); auto local_mesh = *( pm.mesh()->localMesh() ); - auto owned_items = - local_grid->indexSpace( Cajita::Own(), entity, Cajita::Local() ); + auto owned_items = local_grid->indexSpace( Cabana::Grid::Own(), entity, + Cabana::Grid::Local() ); parallel_for( "advection loop", createExecutionPolicy( owned_items, exec_space ), KOKKOS_LAMBDA( int i, int j ) { @@ -160,7 +161,7 @@ void step( const ExecutionSpace& exec_space, ProblemManagerType& pm, } Kokkos::Profiling::popRegion(); - Kokkos::Profiling::pushRegion( "CajitaFluids::TimeIntegrator::Advance" ); + Kokkos::Profiling::pushRegion( "CabanaFluids::TimeIntegrator::Advance" ); // Once all calculations with the current versions of the fields (including // Velocity!) are done, swap the old values with the new one to finish the // time step. @@ -179,6 +180,6 @@ void step( const ExecutionSpace& exec_space, ProblemManagerType& pm, //---------------------------------------------------------------------------// } // end namespace TimeIntegrator -} // end namespace CajitaFluids +} // end namespace CabanaFluids #endif // CAJITAFLUIDS_TIMEINTEGRATOR_HPP diff --git a/src/VelocityCorrector.hpp b/src/VelocityCorrector.hpp index 8004964..62a6298 100644 --- a/src/VelocityCorrector.hpp +++ b/src/VelocityCorrector.hpp @@ -1,33 +1,32 @@ /**************************************************************************** - * Copyright (c) 2018-2020 by the CajitaFluids authors * + * Copyright (c) 2018-2020 by the CabanaFluids authors * * All rights reserved. * * * - * This file is part of the CajitaFluids library. CajitaFluids is * + * This file is part of the CabanaFluids library. CabanaFluids is * * distributed under a BSD 3-clause license. For the licensing terms see * * the LICENSE file in the top-level directory. * * * * SPDX-License-Identifier: BSD-3-Clause * ****************************************************************************/ -#ifndef CAJITAFLUIDS_VELOCITYCORRECTOR_HPP -#define CAJITAFLUIDS_VELOCITYCORRECTOR_HPP +#ifndef CABANAFLUIDS_VELOCITYCORRECTOR_HPP +#define CABANAFLUIDS_VELOCITYCORRECTOR_HPP -#include -#include -#include +#include +#include +#include #include #include #include #include -#include #include #include #include -namespace CajitaFluids +namespace CabanaFluids { /* * VelocityCorrector uses a virtual base class because the overall structure @@ -53,19 +52,22 @@ class VelocityCorrector<2, ExecutionSpace, MemorySpace, SparseSolver> { public: using device_type = Kokkos::Device; - using mesh_type = Cajita::UniformMesh; + using mesh_type = Cabana::Grid::UniformMesh; using cell_array = - Cajita::Array; + Cabana::Grid::Array; using pm_type = ProblemManager<2, ExecutionSpace, MemorySpace>; using bc_type = BoundaryCondition<2>; +#ifdef Cabana_ENABLE_HYPRE using hypre_solver_type = - Cajita::HypreStructuredSolver; + Cabana::Grid::HypreStructuredSolver; +#endif using reference_solver_type = - Cajita::ReferenceStructuredSolver; - using Cell = Cajita::Cell; - using FaceI = Cajita::Face; - using FaceJ = Cajita::Face; + Cabana::Grid::ReferenceStructuredSolver; + using Cell = Cabana::Grid::Cell; + using FaceI = Cabana::Grid::Face; + using FaceJ = Cabana::Grid::Face; VelocityCorrector( const std::shared_ptr& pm, bc_type& bc, const std::shared_ptr& pressure_solver, @@ -81,13 +83,13 @@ class VelocityCorrector<2, ExecutionSpace, MemorySpace, SparseSolver> // Create the LHS and RHS vectors used calculate pressure correction // amount at each cell auto vector_layout = - Cajita::createArrayLayout( _mesh->localGrid(), 1, Cell() ); - _lhs = Cajita::createArray( "pressure LHS", - vector_layout ); - _rhs = Cajita::createArray( "pressure RHS", - vector_layout ); - Cajita::ArrayOp::assign( *_lhs, 0.0, Cajita::Ghost() ); - Cajita::ArrayOp::assign( *_rhs, 0.0, Cajita::Ghost() ); + Cabana::Grid::createArrayLayout( _mesh->localGrid(), 1, Cell() ); + _lhs = Cabana::Grid::createArray( "pressure LHS", + vector_layout ); + _rhs = Cabana::Grid::createArray( "pressure RHS", + vector_layout ); + Cabana::Grid::ArrayOp::assign( *_lhs, 0.0, Cabana::Grid::Ghost() ); + Cabana::Grid::ArrayOp::assign( *_rhs, 0.0, Cabana::Grid::Ghost() ); // Set up the solver to compute the pressure at each point using a // 5-point 2d laplacian stencil. The matrix itself will have 0 weights @@ -102,15 +104,15 @@ class VelocityCorrector<2, ExecutionSpace, MemorySpace, SparseSolver> _pressure_solver->setTolerance( 1.0e-6 ); _pressure_solver->setMaxIter( 2000 ); - _pressure_solver->setPrintLevel( 1 ); + _pressure_solver->setPrintLevel( 0 ); _pressure_solver->setup(); // Finally, we need to halo pressure values with neighbors with whom // we share a face so that we can correct velocities on those faces. // Note that this is a much simpler and shallower halo poattern than the // ones used for advection. - _pressure_halo = Cajita::createHalo( - *vector_layout, Cajita::FaceHaloPattern<2>(), 1 ); + _pressure_halo = Cabana::Grid::createHalo( + Cabana::Grid::FaceHaloPattern<2>(), 1, *_lhs ); } template @@ -121,10 +123,10 @@ class VelocityCorrector<2, ExecutionSpace, MemorySpace, SparseSolver> // Build the solver matrix - set the default entry for each cell // then apply the boundary conditions to it - auto owned_space = - local_grid->indexSpace( Cajita::Own(), Cell(), Cajita::Local() ); - auto l2g = Cajita::IndexConversion::createL2G( *( _mesh->localGrid() ), - Cell() ); + auto owned_space = local_grid->indexSpace( Cabana::Grid::Own(), Cell(), + Cabana::Grid::Local() ); + auto l2g = Cabana::Grid::IndexConversion::createL2G( + *( _mesh->localGrid() ), Cell() ); auto scale = _dt / ( _density * _mesh->cellSize() * _mesh->cellSize() ); const bc_type& bc = _bc; @@ -143,18 +145,20 @@ class VelocityCorrector<2, ExecutionSpace, MemorySpace, SparseSolver> } ); } +#ifdef Cabana_ENABLE_HYPRE // Specialization of matrix fill for Hypre void fillMatrixValues( std::shared_ptr& solver ) { auto matrix_entry_layout = - Cajita::createArrayLayout( _mesh->localGrid(), 5, Cell() ); - auto matrix_entries = Cajita::createArray( + Cabana::Grid::createArrayLayout( _mesh->localGrid(), 5, Cell() ); + auto matrix_entries = Cabana::Grid::createArray( "matrix_entries", matrix_entry_layout ); initializeMatrixValues( matrix_entries->view() ); solver->setMatrixValues( *matrix_entries ); } +#endif - // Specialization of matrix fill for the Cajita structured solver + // Specialization of matrix fill for the Cabana structured solver void fillMatrixValues( std::shared_ptr& solver ) { const auto& matrix_entries = solver->getMatrixValues(); @@ -167,8 +171,8 @@ class VelocityCorrector<2, ExecutionSpace, MemorySpace, SparseSolver> solver->setPreconditionerStencil( diag_stencil, false ); const auto& preconditioner_entries = solver->getPreconditionerValues(); auto local_grid = _mesh->localGrid(); - auto owned_space = - local_grid->indexSpace( Cajita::Own(), Cell(), Cajita::Local() ); + auto owned_space = local_grid->indexSpace( Cabana::Grid::Own(), Cell(), + Cabana::Grid::Local() ); auto preconditioner_view = preconditioner_entries.view(); Kokkos::parallel_for( @@ -190,15 +194,15 @@ class VelocityCorrector<2, ExecutionSpace, MemorySpace, SparseSolver> _pm->gather( Version::Current() ); Kokkos::Profiling::popRegion(); - Cajita::ArrayOp::assign( *_rhs, 0.0, Cajita::Own() ); + Cabana::Grid::ArrayOp::assign( *_rhs, 0.0, Cabana::Grid::Own() ); auto scale = 1.0 / _mesh->cellSize(); auto u = _pm->get( FaceI(), Field::Velocity(), Version::Current() ); auto v = _pm->get( FaceJ(), Field::Velocity(), Version::Current() ); auto local_grid = _mesh->localGrid(); - auto cell_space = local_grid->indexSpace( Cajita::Own(), Cajita::Cell(), - Cajita::Local() ); + auto cell_space = local_grid->indexSpace( + Cabana::Grid::Own(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); auto rhs = _rhs->view(); Kokkos::parallel_for( @@ -221,13 +225,13 @@ class VelocityCorrector<2, ExecutionSpace, MemorySpace, SparseSolver> auto v = _pm->get( FaceJ(), Field::Velocity(), Version::Current() ); auto p = _lhs->view(); - auto l2g = Cajita::IndexConversion::createL2G( *( _mesh->localGrid() ), - Cell() ); + auto l2g = Cabana::Grid::IndexConversion::createL2G( + *( _mesh->localGrid() ), Cell() ); auto local_grid = _mesh->localGrid(); - auto iface_space = - local_grid->indexSpace( Cajita::Own(), FaceI(), Cajita::Local() ); - auto jface_space = - local_grid->indexSpace( Cajita::Own(), FaceJ(), Cajita::Local() ); + auto iface_space = local_grid->indexSpace( Cabana::Grid::Own(), FaceI(), + Cabana::Grid::Local() ); + auto jface_space = local_grid->indexSpace( Cabana::Grid::Own(), FaceJ(), + Cabana::Grid::Local() ); /* Now apply the LHS to adjust the velocity field. We need to * halo the lhs (the computed pressure) to adjust edge velocities. */ @@ -269,7 +273,7 @@ class VelocityCorrector<2, ExecutionSpace, MemorySpace, SparseSolver> Kokkos::Profiling::pushRegion( "VelocityCorrector::BuildProblem" ); _buildRHS(); - Cajita::ArrayOp::assign( *_lhs, 0.0, Cajita::Own() ); + Cabana::Grid::ArrayOp::assign( *_lhs, 0.0, Cabana::Grid::Own() ); Kokkos::Profiling::popRegion(); Kokkos::Profiling::pushRegion( "VelocityCorrector::PresureSolve" ); @@ -288,7 +292,7 @@ class VelocityCorrector<2, ExecutionSpace, MemorySpace, SparseSolver> double _dt; std::shared_ptr> _mesh; std::shared_ptr _pressure_solver; - std::shared_ptr> _pressure_halo; + std::shared_ptr> _pressure_halo; std::shared_ptr _lhs; std::shared_ptr _rhs; @@ -302,42 +306,60 @@ createVelocityCorrector( const std::shared_ptr& pm, const double delta_t, std::string solver, std::string precon ) { - using mesh_type = Cajita::UniformMesh; + using mesh_type = Cabana::Grid::UniformMesh; +#ifdef Cabana_ENABLE_HYPRE using hypre_solver_type = - Cajita::HypreStructuredSolver; + Cabana::Grid::HypreStructuredSolver; +#endif using reference_solver_type = - Cajita::ReferenceStructuredSolver; + Cabana::Grid::ReferenceStructuredSolver; - auto vector_layout = - Cajita::createArrayLayout( pm->mesh()->localGrid(), 1, Cajita::Cell() ); + auto vector_layout = Cabana::Grid::createArrayLayout( + pm->mesh()->localGrid(), 1, Cabana::Grid::Cell() ); if ( solver.compare( "Reference" ) == 0 ) { - auto ps = Cajita::createReferenceConjugateGradient( - *vector_layout ); - // The velocity corrector will create the relevant preconditioner here - // since it depends on the matrix values - return std::make_shared( + *vector_layout ); + if ( ( precon.compare( "Jacobi" ) != 0 ) + && ( precon.compare( "Diagonal" ) != 0 ) ) + { + std::cerr << "Reference solver supports only Jacobi preconditioner." + << std::endl; + exit(-1); + } + return std::make_shared>( pm, bc, ps, density, delta_t ); } else { - auto ps = Cajita::createHypreStructuredSolver( - solver, *vector_layout ); +#ifdef Cabana_ENABLE_HYPRE + HYPRE_Init(); // Cabana requires we explicitly init HYPRE here. + auto ps = + Cabana::Grid::createHypreStructuredSolver( + solver, *vector_layout ); if ( precon.compare( "None" ) != 0 && precon.compare( "none" ) != 0 ) { auto preconditioner = - Cajita::createHypreStructuredSolver( + Cabana::Grid::createHypreStructuredSolver( precon, *vector_layout, true ); ps->setPreconditioner( preconditioner ); } - return std::make_shared>( pm, bc, ps, density, delta_t ); +#else + std::cerr << "Only reference solver available without hypre." + << std::endl; + exit(-1); +#endif } + } -} // namespace CajitaFluids +} // namespace CabanaFluids #endif // CAJITAFLUIDS_VELOCITYCORRECTOR diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8d957db..f7bfd68 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,26 +1,26 @@ blt_add_executable(NAME tstMesh SOURCES tstMesh.cpp INCLUDES tstMesh.hpp - DEPENDS_ON cajitafluids gtest) + DEPENDS_ON cabanafluids gtest) blt_add_test(NAME MeshTests COMMAND tstMesh) blt_add_executable(NAME tstProblemManager SOURCES tstProblemManager.cpp INCLUDES tstProblemManager.hpp tstMesh.hpp - DEPENDS_ON cajitafluids gtest) + DEPENDS_ON cabanafluids gtest) blt_add_test(NAME ProblemManagerTests COMMAND tstProblemManager) blt_add_executable(NAME tstBoundaryConditions SOURCES tstBoundaryConditions.cpp INCLUDES tstoundaryConditions.hpp tstProblemManager.hpp tstMesh.hpp - DEPENDS_ON cajitafluids gtest) + DEPENDS_ON cabanafluids gtest) blt_add_test(NAME BoundaryConditionTests COMMAND tstBoundaryConditions) #blt_add_executable(NAME tstInflowSource # SOURCES tstInflowSource.cpp # INCLUDES tstMeshSetup.hpp -# DEPENDS_ON cajitafluids gtest) +# DEPENDS_ON cabanafluids gtest) #blt_add_test(tstInflowSource) diff --git a/tests/tstBoundaryConditions.cpp b/tests/tstBoundaryConditions.cpp index 221781e..6da2513 100644 --- a/tests/tstBoundaryConditions.cpp +++ b/tests/tstBoundaryConditions.cpp @@ -3,7 +3,7 @@ // Include Statements #include -#include +#include #include #include diff --git a/tests/tstBoundaryConditions.hpp b/tests/tstBoundaryConditions.hpp index 85e1c24..1a0fbd7 100644 --- a/tests/tstBoundaryConditions.hpp +++ b/tests/tstBoundaryConditions.hpp @@ -6,7 +6,7 @@ // Include Statements #include -#include +#include #include #include diff --git a/tests/tstMesh.cpp b/tests/tstMesh.cpp index de6efbb..7b12fbc 100644 --- a/tests/tstMesh.cpp +++ b/tests/tstMesh.cpp @@ -1,7 +1,7 @@ #include "gtest/gtest.h" #include -#include +#include #include #include @@ -40,12 +40,12 @@ TYPED_TEST( MeshTest, LocalGridSetup ) for ( int i = 0; i < 2; i++ ) { EXPECT_EQ( this->boxCells_, - global_grid.globalNumEntity( Cajita::Cell(), i ) ); + global_grid.globalNumEntity( Cabana::Grid::Cell(), i ) ); } /* Make sure the number of owned cells is our share of what was requested */ auto own_local_cell_space = local_grid->indexSpace( - Cajita::Own(), Cajita::Cell(), Cajita::Local() ); + Cabana::Grid::Own(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); for ( int i = 0; i < 2; i++ ) { EXPECT_EQ( own_local_cell_space.extent( i ), @@ -59,7 +59,8 @@ TYPED_TEST( MeshTest, LocalGridSetup ) * spatial dimension. */ auto ghost_local_face_space = local_grid->indexSpace( - Cajita::Ghost(), Cajita::Face(), Cajita::Local() ); + Cabana::Grid::Ghost(), Cabana::Grid::Face(), + Cabana::Grid::Local() ); EXPECT_EQ( ghost_local_face_space.extent( 0 ), this->boxCells_ / global_grid.dimNumBlock( 1 ) + 2 * this->haloWidth_ + 1 ); diff --git a/tests/tstMesh.hpp b/tests/tstMesh.hpp index 4897d6b..aff6afa 100644 --- a/tests/tstMesh.hpp +++ b/tests/tstMesh.hpp @@ -4,7 +4,7 @@ #include "gtest/gtest.h" #include -#include +#include #include #include @@ -25,20 +25,22 @@ template class MeshTest : public ::testing::Test { - // We need Cajita Arrays + // We need Cabana Grid Arrays // Convenience type declarations - using Cell = Cajita::Cell; + using Cell = Cabana::Grid::Cell; - using cell_array = - Cajita::Array, - typename T::MemorySpace>; + using cell_array = Cabana::Grid::Array, + typename T::MemorySpace>; using iface_array = - Cajita::Array, - Cajita::UniformMesh, typename T::MemorySpace>; + Cabana::Grid::Array, + Cabana::Grid::UniformMesh, + typename T::MemorySpace>; using jface_array = - Cajita::Array, - Cajita::UniformMesh, typename T::MemorySpace>; - using mesh_type = CajitaFluids::Mesh<2, typename T::ExecutionSpace, + Cabana::Grid::Array, + Cabana::Grid::UniformMesh, + typename T::MemorySpace>; + using mesh_type = CabanaFluids::Mesh<2, typename T::ExecutionSpace, typename T::MemorySpace>; protected: @@ -48,7 +50,7 @@ class MeshTest : public ::testing::Test virtual void SetUp() override { - // Allocate and initialize the Cajita mesh + // Allocate and initialize the Cabana::Grid mesh globalBoundingBox_ = { 0, 0, boxWidth_, boxWidth_ }; globalNumCells_ = { boxCells_, boxCells_ }; testMesh_ = std::make_shared( globalBoundingBox_, @@ -58,7 +60,7 @@ class MeshTest : public ::testing::Test virtual void TearDown() override { testMesh_ = NULL; } - Cajita::DimBlockPartitioner<2> partitioner_; + Cabana::Grid::DimBlockPartitioner<2> partitioner_; std::array globalNumCells_; Kokkos::Array globalBoundingBox_; diff --git a/tests/tstProblemManager.cpp b/tests/tstProblemManager.cpp index b5b67c6..3bf1d10 100644 --- a/tests/tstProblemManager.cpp +++ b/tests/tstProblemManager.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -11,14 +11,14 @@ TYPED_TEST_SUITE( ProblemManagerTest, MeshDeviceTypes ); -using Cell = Cajita::Cell; -using FaceI = Cajita::Face; -using FaceJ = Cajita::Face; -using FaceK = Cajita::Face; -using Quantity = CajitaFluids::Field::Quantity; -using Velocity = CajitaFluids::Field::Velocity; -using Current = CajitaFluids::Version::Current; -using Next = CajitaFluids::Version::Next; +using Cell = Cabana::Grid::Cell; +using FaceI = Cabana::Grid::Face; +using FaceJ = Cabana::Grid::Face; +using FaceK = Cabana::Grid::Face; +using Quantity = CabanaFluids::Field::Quantity; +using Velocity = CabanaFluids::Field::Velocity; +using Current = CabanaFluids::Version::Current; +using Next = CabanaFluids::Version::Next; TYPED_TEST( ProblemManagerTest, StateArrayTest ) { @@ -37,8 +37,8 @@ TYPED_TEST( ProblemManagerTest, StateArrayTest ) * FaceJ: +2 * Next(): +5 */ - auto qspace = mesh->localGrid()->indexSpace( Cajita::Own(), Cell(), - Cajita ::Local() ); + auto qspace = mesh->localGrid()->indexSpace( Cabana::Grid::Own(), Cell(), + Cabana::Grid ::Local() ); Kokkos::parallel_for( "InitializeCellFields", createExecutionPolicy( qspace, ExecutionSpace() ), @@ -66,8 +66,8 @@ TYPED_TEST( ProblemManagerTest, HaloTest ) auto mesh = pm->mesh(); auto rank = mesh->rank(); auto ucurr = pm->get( FaceI(), Velocity(), Current() ); - auto uspace = mesh->localGrid()->indexSpace( Cajita::Own(), FaceI(), - Cajita ::Local() ); + auto uspace = mesh->localGrid()->indexSpace( Cabana::Grid::Own(), FaceI(), + Cabana::Grid ::Local() ); Kokkos::parallel_for( "InitializeFaceIFields", createExecutionPolicy( uspace, ExecutionSpace() ), @@ -87,7 +87,7 @@ TYPED_TEST( ProblemManagerTest, HaloTest ) auto dir = directions[i]; int neighbor_rank = mesh->localGrid()->neighborRank( dir ); auto u_shared_space = mesh->localGrid()->sharedIndexSpace( - Cajita::Ghost(), FaceI(), dir ); + Cabana::Grid::Ghost(), FaceI(), dir ); for ( int i = u_shared_space.min( 0 ); i < u_shared_space.max( 0 ); i++ ) for ( int j = u_shared_space.min( 1 ); j < u_shared_space.max( 1 ); diff --git a/tests/tstProblemManager.hpp b/tests/tstProblemManager.hpp index 30da3f6..01a6c29 100644 --- a/tests/tstProblemManager.hpp +++ b/tests/tstProblemManager.hpp @@ -2,7 +2,7 @@ #define _TSTPROBLEMMANGER_HPP_ #include -#include +#include #include #include @@ -15,7 +15,7 @@ class NullInitFunctor { public: KOKKOS_INLINE_FUNCTION - bool operator()( Cajita::Cell, CajitaFluids::Field::Quantity, + bool operator()( Cabana::Grid::Cell, CabanaFluids::Field::Quantity, [[maybe_unused]] const int index[Dim], [[maybe_unused]] const double x[Dim], [[maybe_unused]] double& quantity ) const @@ -24,8 +24,8 @@ class NullInitFunctor }; KOKKOS_INLINE_FUNCTION - bool operator()( Cajita::Face, - CajitaFluids::Field::Velocity, + bool operator()( Cabana::Grid::Face, + CabanaFluids::Field::Velocity, [[maybe_unused]] const int index[Dim], [[maybe_unused]] const double x[Dim], [[maybe_unused]] double& quantity ) const @@ -34,8 +34,8 @@ class NullInitFunctor }; KOKKOS_INLINE_FUNCTION - bool operator()( Cajita::Face, - CajitaFluids::Field::Velocity, + bool operator()( Cabana::Grid::Face, + CabanaFluids::Field::Velocity, [[maybe_unused]] const int index[Dim], [[maybe_unused]] const double x[Dim], [[maybe_unused]] double& quantity ) const @@ -48,7 +48,7 @@ template class ProblemManagerTest : public MeshTest { - using pm_type = CajitaFluids::ProblemManager<2, typename T::ExecutionSpace, + using pm_type = CabanaFluids::ProblemManager<2, typename T::ExecutionSpace, typename T::MemorySpace>; protected: