sphereParticlesKernels.hpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 #ifndef __sphereParticlesKernels_hpp__
22 #define __sphereParticlesKernels_hpp__
23 
25 {
26 
27 using rpAcceleration = Kokkos::RangePolicy<
29  Kokkos::Schedule<Kokkos::Static>,
30  Kokkos::IndexType<int32>
31  >;
32 
33 template<typename IncludeFunctionType>
35  realx3 g,
40  IncludeFunctionType incld,
43  )
44 {
45 
46  auto activeRange = incld.activeRange();
47  if(incld.allActive())
48  {
49  Kokkos::parallel_for(
50  "pFlow::sphereParticlesKernels::acceleration",
51  rpAcceleration(activeRange.first, activeRange.second),
52  LAMBDA_HD(int32 i){
53  lAcc[i] = force[i]/mass[i] + g;
54  rAcc[i] = torque[i]/I[i];
55  });
56  }
57  else
58  {
59  Kokkos::parallel_for(
60  "pFlow::sphereParticlesKernels::acceleration",
61  rpAcceleration(activeRange.first, activeRange.second),
62  LAMBDA_HD(int32 i){
63  if(incld(i))
64  {
65  lAcc[i] = force[i]/mass[i] + g;
66  rAcc[i] = torque[i]/I[i];
67  }
68  });
69 
70  }
71 
72  Kokkos::fence();
73 }
74 
75 }
76 
77 #endif
pFlow::sphereParticlesKernels::rpAcceleration
Kokkos::RangePolicy< DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Static >, Kokkos::IndexType< int32 > > rpAcceleration
Definition: sphereParticlesKernels.hpp:31
pFlow::DefaultExecutionSpace
Kokkos::DefaultExecutionSpace DefaultExecutionSpace
Definition: KokkosTypes.hpp:47
pFlow::sphereParticlesKernels::acceleration
void acceleration(realx3 g, deviceViewType1D< real > mass, deviceViewType1D< realx3 > force, deviceViewType1D< real > I, deviceViewType1D< realx3 > torque, IncludeFunctionType incld, deviceViewType1D< realx3 > lAcc, deviceViewType1D< realx3 > rAcc)
Definition: sphereParticlesKernels.hpp:34
pFlow::deviceViewType1D
Kokkos::View< T * > deviceViewType1D
Definition: KokkosTypes.hpp:93
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
LAMBDA_HD
#define LAMBDA_HD
Definition: pFlowMacros.hpp:54
pFlow::sphereParticlesKernels
Definition: sphereParticlesKernels.hpp:24
pFlow::triple< real >