Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions cmake/FindSILO.cmake
Original file line number Diff line number Diff line change
@@ -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()
20 changes: 0 additions & 20 deletions cmake/FindSilo.cmake

This file was deleted.

3 changes: 2 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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} )
43 changes: 22 additions & 21 deletions examples/advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
#define DEBUG 0
#endif

//#define HYPRE
// #define HYPRE

// Include Statements
#include <BoundaryConditions.hpp>
#include <Solver.hpp>

#include <Cabana_Core.hpp>
#include <Cajita.hpp>
#include <Cabana_Grid.hpp>
#include <Kokkos_Core.hpp>

#include <mpi.h>
Expand All @@ -34,7 +34,7 @@
#include <iostream>
#include <stdlib.h>

using namespace CajitaFluids;
using namespace CabanaFluids;

// Short Args: n - Cell Count, s - Domain Size,
// x - On-node Parallelism ( Serial/Threaded/OpenMP/CUDA ),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -403,8 +403,8 @@ struct MeshInitFunc
return true;
};
KOKKOS_INLINE_FUNCTION
bool operator()( Cajita::Face<Cajita::Dim::I>,
CajitaFluids::Field::Velocity,
bool operator()( Cabana::Grid::Face<Cabana::Grid::Dim::I>,
CabanaFluids::Field::Velocity,
[[maybe_unused]] const int index[Dim],
[[maybe_unused]] const double x[Dim],
double& xvelocity ) const
Expand All @@ -413,8 +413,8 @@ struct MeshInitFunc
return true;
};
KOKKOS_INLINE_FUNCTION
bool operator()( Cajita::Face<Cajita::Dim::J>,
CajitaFluids::Field::Velocity,
bool operator()( Cabana::Grid::Face<Cabana::Grid::Dim::J>,
CabanaFluids::Field::Velocity,
[[maybe_unused]] const int index[Dim],
[[maybe_unused]] const double x[Dim],
double& yvelocity ) const
Expand All @@ -424,7 +424,7 @@ struct MeshInitFunc
}
#if 0
KOKKOS_INLINE_FUNCTION
bool operator()( Cajita::Face<Cajita::Dim::K>,
bool operator()( Cabana::Grid::Face<Cabana::Grid::Dim::K>,
[[maybe_unused]] const int coords[Dim],
[[maybe_unused]] const int x[Dim],
double &zvelocity ) const {
Expand All @@ -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 );
Expand All @@ -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
Expand Down
26 changes: 14 additions & 12 deletions src/BodyForce.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
* @author Patrick Bridges <patrickb@unm.edu>
*
* @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 <Mesh.hpp>

#include <Cabana_Core.hpp>
#include <Cabana_Grid.hpp>
#include <Kokkos_Core.hpp>

namespace CajitaFluids
#include <Mesh.hpp>

namespace CabanaFluids
{
/**
* @struct BodyForce
Expand All @@ -32,7 +34,7 @@ struct BodyForce<2>
{
template <class ArrayType>
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,
Expand All @@ -43,17 +45,17 @@ struct BodyForce<2>
/* Simple forward Euler for body forces */
template <class ArrayType>
KOKKOS_INLINE_FUNCTION void
operator()( Cajita::Face<Cajita::Dim::I>, ArrayType& ux, int i, int j,
[[maybe_unused]] double x, [[maybe_unused]] double y,
operator()( Cabana::Grid::Face<Cabana::Grid::Dim::I>, 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;
}

template <class ArrayType>
KOKKOS_INLINE_FUNCTION void
operator()( Cajita::Face<Cajita::Dim::J>, ArrayType& uy, int i, int j,
[[maybe_unused]] double x, [[maybe_unused]] double y,
operator()( Cabana::Grid::Face<Cabana::Grid::Dim::J>, 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;
Expand All @@ -67,6 +69,6 @@ struct BodyForce<2>

Kokkos::Array<double, 2> _force; /**< Force exerted on all cells. */
};
} // namespace CajitaFluids
} // namespace CabanaFluids

#endif
22 changes: 12 additions & 10 deletions src/BoundaryConditions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@
* @author Jered Dominguez-Trujillo <jereddt@unm.edu>
*
* @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 <Mesh.hpp>

#include <Cabana_Core.hpp>
#include <Cabana_Grid.hpp>
#include <Kokkos_Core.hpp>

namespace CajitaFluids
#include <Mesh.hpp>

namespace CabanaFluids
{
/**
* @struct BoundaryType
Expand Down Expand Up @@ -50,9 +52,9 @@ struct BoundaryCondition;
template <>
struct BoundaryCondition<2>
{
using Cell = Cajita::Cell;
using FaceI = Cajita::Face<Cajita::Dim::I>;
using FaceJ = Cajita::Face<Cajita::Dim::J>;
using Cell = Cabana::Grid::Cell;
using FaceI = Cabana::Grid::Face<Cabana::Grid::Dim::I>;
using FaceJ = Cabana::Grid::Face<Cabana::Grid::Dim::J>;
template <class ArrayType>
KOKKOS_INLINE_FUNCTION void
build_matrix( const int gi, const int gj, const int i, const int j,
Expand Down Expand Up @@ -134,6 +136,6 @@ struct BoundaryCondition<2>
Kokkos::Array<int, 2> max;
};

} // namespace CajitaFluids
} // namespace CabanaFluids

#endif
10 changes: 5 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ set(SOURCES
)

set(DEPENDS_ON
Cabana::cabanacore
Cabana::Cajita
Silo::silo
mpi
Cabana::Core
Cabana::Grid
SILO::silo
MPI::MPI_CXX
)

set(INCLUDES
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)

blt_add_library( NAME cajitafluids
blt_add_library( NAME cabanafluids
HEADERS ${HEADERS}
SOURCES ${SOURCES}
INCLUDES ${INCLUDES}
Expand Down
Loading