geometry.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 __geometry_hpp__
22 #define __geometry_hpp__
23 
24 
25 #include "virtualConstructor.hpp"
26 #include "demGeometry.hpp"
27 #include "property.hpp"
28 #include "Fields.hpp"
29 #include "Vectors.hpp"
30 #include "multiTriSurface.hpp"
31 #include "triSurfaceFields.hpp"
32 #include "dictionary.hpp"
33 
34 namespace pFlow
35 {
36 
37 class geometry
38 :
39  public demGeometry
40 {
41 protected:
42 
43  const property& wallProperty_;
44 
45  // - this object is owned by geometryRepository_
47 
48  // all triangles of walls
50 
51  //
53 
54  //
56 
58 
60 
62 
63  bool findPropertyId();
64 
65  void zeroForce()
66  {
68  }
69 
70 
71 public:
72 
73  // - type info
74  TypeInfo("geometry");
75 
77 
78  // - empty
79  geometry(systemControl& control, const property& prop);
80 
81  // - from components
83  const property& prop,
85  const wordVector& motionCompName,
86  const wordVector& propName
87  );
88 
90  const property& prop,
91  const dictionary& dict,
93  const wordVector& motionCompName,
94  const wordVector& propName);
95 
96 
97  virtual ~geometry() = default;
98 
100  (
101  geometry,
103  (
105  const property& prop
106  ),
107  (control, prop)
108  );
109 
111  (
112  geometry,
113  dictionary,
115  const property& prop,
116  const dictionary& dict,
118  const wordVector& motionCompName,
119  const wordVector& propName),
120  (control, prop, dict, triSurface, motionCompName, propName)
121  );
122 
124 
125  inline
126  auto size()const
127  {
128  return triSurface_.size();
129  }
130 
131  inline
132  auto numPoints()const
133  {
134  return triSurface_.numPoints();
135  }
136 
137  inline
138  auto numTriangles()const
139  {
140  return size();
141  }
142 
143  inline
144  const auto& points()const
145  {
146  return triSurface_.points();
147  }
148 
149  inline
150  const auto& vertices()const
151  {
152  return triSurface_.vertices();
153  }
154 
155  inline auto getTriangleAccessor()const
156  {
158  }
159 
160  inline auto& surface()
161  {
162  return triSurface_;
163  }
164 
165  inline const auto& surface()const
166  {
167  return triSurface_;
168  }
169 
170  inline
172  {
173  return contactForceWall_;
174  }
175 
176  inline
178  {
179  return contactForceWall_;
180  }
181 
182  inline const auto& wallProperty()const
183  {
184  return wallProperty_;
185  }
186 
187  // owner repository
188  inline
189  const repository& owner()const
190  {
191  return geometryRepository_;
192  }
193 
194  inline
196  {
197  return geometryRepository_;
198  }
199 
200  inline auto path()
201  {
202  return owner().path();
203  }
204 
205  virtual
206  word motionModelTypeName()const = 0;
207 
208  virtual
209  const int8Vector_HD& triMotionIndex() const =0;
210 
211  virtual
212  const int8Vector_HD& pointMotionIndex()const = 0;
213 
215  {
216  return propertyId_;
217  }
218 
219  bool beforeIteration() override {
220 
221  this->zeroForce();
222  return true;
223 
224  }
225 
226  bool afterIteration() override {
227 
228  auto Force = contactForceWall_.deviceVectorAll();
229  auto area = triSurface_.area().deviceVectorAll();
230  auto stress = stressWall_.deviceVectorAll();
231  auto numTri =triSurface_.size();
232 
233 
234  Kokkos::parallel_for(
235  "geometry::calculateStress",
236  numTri,
237  LAMBDA_HD(int32 i){
238  stress[i] = Force[i]/area[i];
239  });
240  Kokkos::fence();
241  return true;
242 
243  }
244 
245  bool write()const
246  {
247  return owner().write();
248  }
249 
250 
251  // static
252 
253  static
255 
256  static
259  const property& prop,
260  const dictionary& dict,
262  const wordVector& motionCompName,
263  const wordVector& propName);
264 
265 };
266 
267 }
268 
269 #endif
pFlow::geometry::materialName_
wordField & materialName_
Definition: geometry.hpp:55
pFlow::triSurface::getTriangleAccessor
auto getTriangleAccessor() const
Definition: triSurface.hpp:174
pFlow::geometry::geometryRepository_
repository & geometryRepository_
Definition: geometry.hpp:46
pFlow::geometry::motionComponentName_
wordField & motionComponentName_
Definition: geometry.hpp:52
pFlow::geometry::surface
auto & surface()
Definition: geometry.hpp:160
pFlow::geometry::findPropertyId
bool findPropertyId()
Definition: geometry.cpp:25
triSurfaceFields.hpp
pFlow::geometry::points
const auto & points() const
Definition: geometry.hpp:144
pFlow::demComponent::control
const auto & control() const
Definition: demComponent.hpp:57
pFlow::geometry::contactForceWall
const realx3TriSurfaceField_D & contactForceWall() const
Definition: geometry.hpp:177
pFlow::geometry::create
static uniquePtr< geometry > create(systemControl &control, const property &prop)
Definition: geometry.cpp:229
pFlow::geometry::motionModelTypeName
virtual word motionModelTypeName() const =0
pFlow::geometry::size
auto size() const
Definition: geometry.hpp:126
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::systemControl
Definition: systemControl.hpp:41
pFlow::triSurface::area
const realVector_D & area() const
Definition: triSurface.hpp:194
pFlow::zero3
const realx3 zero3(0.0)
Definition: types.hpp:97
Vectors.hpp
pFlow::geometry::wallProperty_
const property & wallProperty_
Definition: geometry.hpp:43
pFlow::Field< Vector, word, vecAllocator< word > >
pFlow::geometry::stressWall_
realx3TriSurfaceField_D & stressWall_
Definition: geometry.hpp:61
pFlow::geometry::owner
const repository & owner() const
Definition: geometry.hpp:189
pFlow::repository::write
virtual bool write(bool verbose=false) const
Definition: repository.cpp:239
pFlow::triSurface::points
const realx3Vector_D & points() const
Definition: triSurface.hpp:184
pFlow
Definition: demComponent.hpp:28
pFlow::multiTriSurface
Definition: multiTriSurface.hpp:33
pFlow::geometry::afterIteration
bool afterIteration() override
Definition: geometry.hpp:226
pFlow::geometry::create_vCtor
create_vCtor(geometry, systemControl,(systemControl &control, const property &prop),(control, prop))
pFlow::geometry::contactForceWall_
realx3TriSurfaceField_D & contactForceWall_
Definition: geometry.hpp:59
pFlow::geometry::~geometry
virtual ~geometry()=default
pFlow::triSurfaceField
Definition: triSurfaceField.hpp:34
pFlow::geometry::triSurface_
multiTriSurface & triSurface_
Definition: geometry.hpp:49
pFlow::geometry::contactForceWall
realx3TriSurfaceField_D & contactForceWall()
Definition: geometry.hpp:171
pFlow::int32
int int32
Definition: builtinTypes.hpp:53
pFlow::VectorDual< int8 >
multiTriSurface.hpp
pFlow::geometry::wallProperty
const auto & wallProperty() const
Definition: geometry.hpp:182
Fields.hpp
dictionary.hpp
pFlow::geometry::write
bool write() const
Definition: geometry.hpp:245
pFlow::geometry::vertices
const auto & vertices() const
Definition: geometry.hpp:150
pFlow::geometry::beforeIteration
bool beforeIteration() override
Definition: geometry.hpp:219
virtualConstructor.hpp
pFlow::triSurface::numPoints
size_t numPoints() const
Definition: triSurface.hpp:149
pFlow::geometry::zeroForce
void zeroForce()
Definition: geometry.hpp:65
pFlow::geometry::numPoints
auto numPoints() const
Definition: geometry.hpp:132
pFlow::repository::path
virtual fileSystem path() const
Definition: repository.cpp:61
pFlow::property
property holds the pure properties of materials.
Definition: property.hpp:40
pFlow::geometry::owner
repository & owner()
Definition: geometry.hpp:195
pFlow::geometry::TypeInfo
TypeInfo("geometry")
pFlow::geometry::surface
const auto & surface() const
Definition: geometry.hpp:165
pFlow::uniquePtr
Definition: uniquePtr.hpp:44
pFlow::geometry
Definition: geometry.hpp:37
LAMBDA_HD
#define LAMBDA_HD
Definition: pFlowMacros.hpp:54
pFlow::triSurface::vertices
const int32x3Vector_D & vertices() const
Definition: triSurface.hpp:214
pFlow::demGeometry
Definition: demGeometry.hpp:31
pFlow::geometry::getTriangleAccessor
auto getTriangleAccessor() const
Definition: geometry.hpp:155
pFlow::repository
Definition: repository.hpp:34
property.hpp
pFlow::triSurface
Definition: triSurface.hpp:38
pFlow::geometry::propertyId_
int8TriSurfaceField_D & propertyId_
Definition: geometry.hpp:57
pFlow::VectorSingle::deviceVectorAll
INLINE_FUNCTION_H viewType & deviceVectorAll()
Definition: VectorSingle.hpp:295
pFlow::geometry::numTriangles
auto numTriangles() const
Definition: geometry.hpp:138
pFlow::Vector< word >
pFlow::geometry::path
auto path()
Definition: geometry.hpp:200
pFlow::geometry::propertyId
const int8TriSurfaceField_D & propertyId() const
Definition: geometry.hpp:214
pFlow::geometry::pointMotionIndex
virtual const int8Vector_HD & pointMotionIndex() const =0
pFlow::dictionary
Definition: dictionary.hpp:38
pFlow::triSurface::size
size_t size() const
Definition: triSurface.hpp:159
pFlow::geometry::geometry
geometry(systemControl &control, const property &prop)
Definition: geometry.cpp:57
pFlow::geometry::triMotionIndex
virtual const int8Vector_HD & triMotionIndex() const =0
demGeometry.hpp