Skip to content

Commit 53c7b23

Browse files
merge from main
2 parents ce7070d + 3d6fa28 commit 53c7b23

File tree

682 files changed

+72971
-20110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

682 files changed

+72971
-20110
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
# files
2+
.clang-format
3+
.vscode
4+
.dependencygraph
5+
16
# Prerequisites
27
*.d
38

9+
410
# Compiled Object files
511
*.slo
612
*.lo

CMakeLists.txt

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,83 @@
11
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
22

33
# set the project name and version
4-
project(phasicFlow VERSION 0.1 )
4+
project(phasicFlow VERSION 1.0 )
55

66
set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE)
77
set(CMAKE_CXX_STANDARD_REQUIRED True)
88
set(CMAKE_INSTALL_PREFIX ${phasicFlow_SOURCE_DIR} CACHE PATH "Install path of phasicFlow" FORCE)
9-
set(CMAKE_BUILD_TYPE Release CACHE STRING "build type" FORCE)
9+
set(CMAKE_BUILD_TYPE Debug CACHE STRING "build type" FORCE)
10+
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build using shared libraries" FORCE)
11+
mark_as_advanced(FORCE var BUILD_SHARED_LIBS)
1012

1113
message(STATUS ${CMAKE_INSTALL_PREFIX})
1214

13-
mark_as_advanced(FORCE var Kokkos_ENABLE_CUDA_LAMBDA)
14-
mark_as_advanced(FORCE var Kokkos_ENABLE_OPENMP)
15-
mark_as_advanced(FORCE var Kokkos_ENABLE_SERIAL)
16-
mark_as_advanced(FORCE var Kokkos_ENABLE_CUDA_LAMBDA)
17-
mark_as_advanced(FORCE var BUILD_SHARED_LIBS)
15+
include(cmake/globals.cmake)
16+
17+
#Kokkos directory to be included
18+
set(Kokkos_Source_DIR)
19+
20+
if(DEFINED ENV{Kokkos_DIR})
21+
set(Kokkos_Source_DIR $ENV{Kokkos_DIR})
22+
else()
23+
set(Kokkos_Source_DIR $ENV{HOME}/Kokkos/kokkos)
24+
endif()
25+
message(STATUS "Kokkos source directory is ${Kokkos_Source_DIR}")
26+
add_subdirectory(${Kokkos_Source_DIR} ./kokkos)
27+
Kokkos_cmake_settings()
28+
1829

19-
option(USE_STD_PARALLEL_ALG "Use TTB std parallel algorithms" ON)
30+
option(pFlow_STD_Parallel_Alg "Use TTB std parallel algorithms" ON)
2031
option(pFlow_Build_Serial "Build phasicFlow and backends for serial execution" OFF)
2132
option(pFlow_Build_OpenMP "Build phasicFlow and backends for OpenMP execution" OFF)
2233
option(pFlow_Build_Cuda "Build phasicFlow and backends for Cuda execution" OFF)
23-
option(pFlow_Build_Double "Build phasicFlow with double precision variables" ON)
34+
option(pFlow_Build_Double "Build phasicFlow with double precision floating-oint variables" ON)
35+
option(pFlow_Build_MPI "Build for MPI parallelization. This will enable multi-gpu run, CPU run on clusters (distributed memory machine). Use this combination Cuda+MPI, OpenMP + MPI or Serial+MPI " OFF)
2436

25-
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build using shared libraries" FORCE)
2637

2738
if(pFlow_Build_Serial)
2839
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Serial execution" FORCE)
2940
set(Kokkos_ENABLE_OPENMP OFF CACHE BOOL "OpenMP execution" FORCE)
3041
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "Cuda execution" FORCE)
3142
set(Kokkos_ENABLE_CUDA_LAMBDA OFF CACHE BOOL "Cuda execution" FORCE)
43+
set(Kokkos_ENABLE_CUDA_CONSTEXPR OFF CACHE BOOL "Enable constexpr on cuda code" FORCE)
3244
elseif(pFlow_Build_OpenMP )
3345
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Serial execution" FORCE)
3446
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "OpenMP execution" FORCE)
3547
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "Cuda execution" FORCE)
3648
set(Kokkos_ENABLE_CUDA_LAMBDA OFF CACHE BOOL "Cuda execution" FORCE)
3749
set(Kokkos_DEFAULT_HOST_PARALLEL_EXECUTION_SPACE SERIAL CACHE STRING "" FORCE)
50+
set(Kokkos_ENABLE_CUDA_CONSTEXPR OFF CACHE BOOL "Enable constexpr on cuda code" FORCE)
3851
elseif(pFlow_Build_Cuda)
3952
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Serial execution" FORCE)
4053
set(Kokkos_ENABLE_OPENMP OFF CACHE BOOL "OpenMP execution" FORCE)
4154
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "Cuda execution" FORCE)
4255
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "Cuda execution" FORCE)
56+
set(Kokkos_ENABLE_CUDA_CONSTEXPR ON CACHE BOOL "Enable constexpr on cuda code" FORCE)
4357
endif()
4458

45-
46-
47-
include(cmake/globals.cmake)
48-
message(STATUS "Valid file extensions are ${validFiles}")
59+
if(pFlow_Build_MPI)
60+
find_package(MPI REQUIRED)
61+
endif()
4962

5063
include(cmake/makeLibraryGlobals.cmake)
5164
include(cmake/makeExecutableGlobals.cmake)
5265

5366
configure_file(phasicFlowConfig.H.in phasicFlowConfig.H)
54-
67+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
5568
#add a global include directory
5669
include_directories(src/setHelpers src/demComponent "${PROJECT_BINARY_DIR}")
5770

58-
#main subdirectories of the code
59-
set(Kokkos_Source_DIR)
60-
61-
if(DEFINED ENV{Kokkos_DIR})
62-
set(Kokkos_Source_DIR $ENV{Kokkos_DIR})
63-
# add_subdirectory($ENV{Kokkos_DIR} ${phasicFlow_BINARY_DIR}/kokkos)
64-
# message(STATUS "Kokkos directory is $ENV{Kokkos_DIR}")
65-
else()
66-
# add_subdirectory($ENV{HOME}/Kokkos/kokkos ${phasicFlow_BINARY_DIR}/kokkos)
67-
set(Kokkos_Source_DIR $ENV{HOME}/Kokkos/kokkos)
68-
endif()
69-
70-
message(STATUS "Kokkos source directory is ${Kokkos_Source_DIR}")
71-
add_subdirectory(${Kokkos_Source_DIR} ${phasicFlow_BINARY_DIR}/kokkos)
72-
7371
add_subdirectory(src)
7472

7573
add_subdirectory(solvers)
7674

7775
add_subdirectory(utilities)
7876

7977
add_subdirectory(DEMSystems)
80-
#add_subdirectory(testIO)
81-
8278

8379
install(FILES "${PROJECT_BINARY_DIR}/phasicFlowConfig.H"
84-
DESTINATION include
85-
)
80+
DESTINATION include)
8681

8782
include(InstallRequiredSystemLibraries)
8883
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")

DEMSystems/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11

22
set(SourceFiles
3+
domainDistribute/domainDistribute.cpp
34
DEMSystem/DEMSystem.cpp
4-
sphereDEMSystem/sphereDEMSystem.cpp
55
sphereDEMSystem/sphereFluidParticles.cpp
6-
domainDistribute/domainDistribute.cpp
6+
sphereDEMSystem/sphereDEMSystem.cpp
7+
grainDEMSystem/grainFluidParticles.cpp
8+
grainDEMSystem/grainDEMSystem.cpp
79
)
810

911
set(link_libs Kokkos::kokkos phasicFlow Particles Geometry Property Interaction Interaction Utilities)

DEMSystems/DEMSystem/DEMSystem.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ pFlow::DEMSystem::DEMSystem(
3333
ControlDict_()
3434
{
3535

36-
REPORT(0)<<"Initializing host/device execution spaces . . . \n";
37-
REPORT(1)<<"Host execution space is "<< greenText(DefaultHostExecutionSpace::name())<<endREPORT;
38-
REPORT(1)<<"Device execution space is "<<greenText(DefaultExecutionSpace::name())<<endREPORT;
36+
REPORT(0)<<"Initializing host/device execution spaces . . . \n";
37+
REPORT(1)<<"Host execution space is "<< Green_Text(DefaultHostExecutionSpace::name())<<END_REPORT;
38+
REPORT(1)<<"Device execution space is "<<Green_Text(DefaultExecutionSpace::name())<<END_REPORT;
3939

4040
// initialize Kokkos
4141
Kokkos::initialize( argc, argv );
4242

43-
REPORT(0)<<"\nCreating Control repository . . ."<<endREPORT;
43+
REPORT(0)<<"\nCreating Control repository . . ."<<END_REPORT;
4444
Control_ = makeUnique<systemControl>(
4545
ControlDict_.startTime(),
4646
ControlDict_.endTime(),
@@ -87,4 +87,3 @@ pFlow::uniquePtr<pFlow::DEMSystem>
8787

8888
return nullptr;
8989
}
90-

DEMSystems/DEMSystem/DEMSystem.hpp

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "types.hpp"
2727
#include "span.hpp"
28+
#include "box.hpp"
2829
#include "virtualConstructor.hpp"
2930
#include "uniquePtr.hpp"
3031
#include "systemControl.hpp"
@@ -60,6 +61,7 @@ class DEMSystem
6061

6162
DEMSystem(const DEMSystem&)=delete;
6263

64+
/// @brief no assignment
6365
DEMSystem& operator = (const DEMSystem&)=delete;
6466

6567
create_vCtor(
@@ -111,19 +113,34 @@ class DEMSystem
111113
int32 numParInDomain(int32 di)const = 0;
112114

113115
virtual
114-
std::vector<int32> numParInDomain()const = 0;
116+
std::vector<int32> numParInDomains()const = 0;
115117

116118
virtual
117-
span<const int32> parIndexInDomain(int32 di)const = 0;
119+
span<const int32> parIndexInDomain(int32 domIndx)const = 0;
118120

119121
virtual
120-
span<real> parDiameter() = 0;
122+
span<real> diameter() = 0;
123+
124+
virtual
125+
span<real> courseGrainFactor() = 0;
126+
127+
virtual
128+
span<realx3> acceleration()=0;
121129

122130
virtual
123-
span<realx3> parVelocity() = 0;
131+
span<realx3> velocity() = 0;
124132

125133
virtual
126-
span<realx3> parPosition() = 0;
134+
span<realx3> position() = 0;
135+
136+
virtual
137+
span<realx3> rAcceleration()=0;
138+
139+
virtual
140+
span<realx3> rVelocity() = 0;
141+
142+
virtual
143+
span<realx3> rPosition() = 0;
127144

128145
virtual
129146
span<realx3> parFluidForce() = 0;
@@ -153,7 +170,6 @@ class DEMSystem
153170
bool iterate(real upToTime) = 0;
154171

155172

156-
157173
static
158174
uniquePtr<DEMSystem>
159175
create(
@@ -162,8 +178,6 @@ class DEMSystem
162178
int argc,
163179
char* argv[]);
164180

165-
166-
167181
};
168182

169183

DEMSystems/domainDistribute/domainDistribute.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void pFlow::domainDistribute::clcDomains(const std::vector<box>& domains)
3333

3434

3535
pFlow::domainDistribute::domainDistribute(
36-
const Vector<box>& domains,
36+
const std::vector<box>& domains,
3737
real maxBoundingBox)
3838
:
3939
numDomains_(domains.size()),
@@ -47,10 +47,10 @@ maxBoundingBoxSize_(maxBoundingBox)
4747
}
4848

4949
bool pFlow::domainDistribute::locateParticles(
50-
ViewType1D<realx3,HostSpace> points, includeMask mask)
50+
ViewType1D<realx3,HostSpace> points, const pFlagTypeHost& mask)
5151
{
5252

53-
range activeRange = mask.activeRange();
53+
const rangeU32 activeRange = mask.activeRange();
5454

5555

5656
for(int32 di=0; di<numDomains_; di++)
@@ -59,7 +59,7 @@ bool pFlow::domainDistribute::locateParticles(
5959
}
6060

6161

62-
for(int32 i=activeRange.first; i<activeRange.second; i++)
62+
for(int32 i=activeRange.start(); i<activeRange.end(); i++)
6363
{
6464
if(mask(i))
6565
{

DEMSystems/domainDistribute/domainDistribute.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,16 @@ class domainDistribute
4343

4444
int32Vector_H numParInDomain_;
4545

46-
4746
real maxBoundingBoxSize_;
4847

4948
real domainExtension_ = 1.0;
5049

51-
using includeMask = typename pointStructure::activePointsHost;
52-
5350
void clcDomains(const std::vector<box>& domains);
5451

5552
public:
5653

5754
domainDistribute(
58-
const Vector<box>& domains,
55+
const std::vector<box>& domains,
5956
real maxBoundingBox);
6057

6158
~domainDistribute()=default;
@@ -78,7 +75,7 @@ class domainDistribute
7875
{
7976
return
8077
span<const int32>(
81-
particlesInDomains_[di].hostVectorAll().data(),
78+
particlesInDomains_[di].hostViewAll().data(),
8279
numParInDomain_[di]
8380
);
8481
}
@@ -91,7 +88,7 @@ class domainDistribute
9188

9289
//template<typename includeMask>
9390
bool locateParticles(
94-
ViewType1D<realx3,HostSpace> points, includeMask mask);
91+
ViewType1D<realx3,HostSpace> points, const pFlagTypeHost& mask);
9592

9693
};
9794

0 commit comments

Comments
 (0)