www.cemf.ir
grainRolling.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 __grainRolling_hpp__
22 #define __grainRolling_hpp__
23 
24 
25 namespace pFlow::cfModels
26 {
27 
28 template<typename contactForceModel>
30 :
31  public contactForceModel
32 {
33 public:
34 
35  using contactForceStorage =
36  typename contactForceModel::contactForceStorage;
37 
38 
40 
41  bool readGrainDict(const dictionary& dict)
42  {
43  auto mur = dict.getVal<realVector>("mur");
44 
45  uint32 nMat;
46 
47  if(!realSymArray_D::getN(mur.size(),nMat) || nMat != this->numMaterial())
48  {
50  "wrong number of values supplied in mur. \n";
51  return false;
52  }
53 
54  mur_.assign(mur);
55 
56  return true;
57  }
58 
59 public:
60 
61  TypeInfoNV(word("normal<"+contactForceModel::TYPENAME()+">"));
62 
63 
64  grainRolling(int32 nMaterial, const ViewType1D<real>& rho, const dictionary& dict)
65  :
66  contactForceModel(nMaterial, rho, dict),
67  mur_("mur", nMaterial)
68  {
69  if(!readGrainDict(dict))
70  {
71  fatalExit;
72  }
73  }
74 
76  void rollingFriction
77  (
78  const real dt,
79  const uint32 i,
80  const uint32 j,
81  const uint32 propId_i,
82  const uint32 propId_j,
83  const real Ri,
84  const real Rj,
85  const real cGFi,
86  const real cGFj,
87  const realx3& wi,
88  const realx3& wj,
89  const realx3& Nij,
90  const realx3& FCn,
91  realx3& Mri,
92  realx3& Mrj
93  )const
94  {
95 
96  realx3 w_hat = wi-wj;
97  real w_hat_mag = length(w_hat);
98 
99  if( !equal(w_hat_mag,0.0) )
100  w_hat /= w_hat_mag;
101  else
102  w_hat = 0.0;
103 
104  auto Reff = (Ri*Rj)/(Ri+Rj);
105 
106  Mri = ( -mur_(propId_i,propId_j) *length(FCn) * Reff ) * w_hat ;
107 
108  //removing the normal part
109  // Mri = Mri - ( (Mri .dot. nij)*nij )
110 
111  Mrj = -Mri;
112  }
113 
114 
115 };
116 
117 }
118 
119 #endif
pFlow::real
float real
Definition: builtinTypes.hpp:45
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::equal
INLINE_FUNCTION_HD bool equal(const box &b1, const box &b2, real tol=smallValue)
Definition: box.hpp:135
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::cfModels::grainRolling
Definition: grainRolling.hpp:29
pFlow::cfModels::grainRolling::rollingFriction
INLINE_FUNCTION_HD void rollingFriction(const real dt, const uint32 i, const uint32 j, const uint32 propId_i, const uint32 propId_j, const real Ri, const real Rj, const real cGFi, const real cGFj, const realx3 &wi, const realx3 &wj, const realx3 &Nij, const realx3 &FCn, realx3 &Mri, realx3 &Mrj) const
Definition: grainRolling.hpp:77
pFlow::symArray< real >::getN
static bool getN(uint32 nElem, uint32 &n)
Definition: symArrayHD.hpp:238
pFlow::symArray::assign
bool assign(const Vector< T > src)
Definition: symArrayHD.hpp:175
pFlow::cfModels::grainRolling::readGrainDict
bool readGrainDict(const dictionary &dict)
Definition: grainRolling.hpp:41
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
length
INLINE_FUNCTION_HD T length(const triple< T > &v1)
pFlow::int32
int int32
Definition: builtinTypes.hpp:50
pFlow::cfModels::grainRolling::grainRolling
grainRolling(int32 nMaterial, const ViewType1D< real > &rho, const dictionary &dict)
Definition: grainRolling.hpp:64
pFlow::cfModels::grainRolling::TypeInfoNV
TypeInfoNV(word("normal<"+contactForceModel::TYPENAME()+">"))
pFlow::ViewType1D
Kokkos::View< T *, properties... > ViewType1D
1D veiw as a vector
Definition: KokkosTypes.hpp:93
pFlow::dictionary::getVal
T getVal(const word &keyword) const
get the value of data entry
Definition: dictionary.hpp:379
pFlow::cfModels::grainRolling::mur_
realSymArray_D mur_
Definition: grainRolling.hpp:39
pFlow::cfModels
Definition: cGAbsoluteLinearCF.hpp:34
INLINE_FUNCTION_HD
#define INLINE_FUNCTION_HD
Definition: pFlowMacros.hpp:55
pFlow::triple< real >
pFlow::Vector< real >
pFlow::symArray< real >
pFlow::cfModels::grainRolling::contactForceStorage
typename contactForceModel::contactForceStorage contactForceStorage
Definition: grainRolling.hpp:36
pFlow::dictionary
Dictionary holds a set of data entries or sub-dictionaries that are enclosed in a curely braces or ar...
Definition: dictionary.hpp:67