www.cemf.ir
particles.cpp
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 #include "particles.hpp"
21 
23  : observer(defaultMessage_),
24  demComponent("particles", control),
25  dynPointStruct_(control),
26  /*id_(
27  objectFile(
28  "id",
29  "",
30  objectFile::READ_IF_PRESENT,
31  objectFile::WRITE_ALWAYS
32  ),
33  dynPointStruct_,
34  static_cast<uint32>(-1),
35  static_cast<uint32>(-1)
36  ),*/
37  shapeIndex_(
38  objectFile(
39  "shapeIndex",
40  "",
41  objectFile::READ_ALWAYS,
42  objectFile::WRITE_ALWAYS
43  ),
44  dynPointStruct_,
45  0
46  ),
47  accelertion_(
48  objectFile(
49  "accelertion",
50  "",
51  objectFile::READ_IF_PRESENT,
52  objectFile::WRITE_ALWAYS
53  ),
54  dynPointStruct_,
55  zero3
56  ),
57  contactForce_(
58  objectFile(
59  "contactForce",
60  "",
61  objectFile::READ_IF_PRESENT,
62  objectFile::WRITE_ALWAYS
63  ),
64  dynPointStruct_,
65  zero3
66  ),
67  contactTorque_(
68  objectFile(
69  "contactTorque",
70  "",
71  objectFile::READ_IF_PRESENT,
72  objectFile::WRITE_ALWAYS
73  ),
74  dynPointStruct_,
75  zero3
76  ),
77  idHandler_(particleIdHandler::create(dynPointStruct_)),
78  baseFieldBoundaryUpdateTimer_("baseFieldBoundaryUpdate",&timers())
79 {
81 
82  //idHandler_().initialIdCheck();
83 }
84 
85 bool
87 {
88  if( !dynPointStruct_.beforeIteration())
89  {
90  return false;
91  }
92 
93  zeroForce();
94  zeroTorque();
95  baseFieldBoundaryUpdateTimer_.start();
96  shapeIndex_.updateBoundariesSlaveToMasterIfRequested();
97  accelertion_.updateBoundariesSlaveToMasterIfRequested();
98  idHandler_().updateBoundariesSlaveToMasterIfRequested();
99  baseFieldBoundaryUpdateTimer_.end();
100  return true;
101 }
102 
103 bool
105 {
106  return dynPointStruct_.iterate();
107 }
108 
109 bool
111 {
112  return dynPointStruct_.afterIteration();
113 }
114 
115 void
117 {
118  auto& shp = getShapes();
119 
120  minDiam = shp.minBoundingSphere();
121  maxDiam = shp.maxBoundingSphere();
122 }
pFlow::observer
Definition: observer.hpp:33
pFlow::particles::beforeIteration
bool beforeIteration() override
This is called in time loop, before iterate.
Definition: particles.cpp:86
pFlow::particles::iterate
bool iterate() override
This is called in time loop.
Definition: particles.cpp:104
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::particleIdHandler
Definition: particleIdHandler.hpp:30
pFlow::systemControl
Definition: systemControl.hpp:41
particles.hpp
pFlow::zero3
const realx3 zero3(0.0)
Definition: types.hpp:137
pFlow::particles::dynPointStruct_
dynamicPointStructure dynPointStruct_
dynamic point structure for particles center mass
Definition: particles.hpp:40
pFlow::particles::particles
particles(systemControl &control)
Definition: particles.cpp:22
pFlow::demComponent
A base class for every main component of DEM system.
Definition: demComponent.hpp:42
pFlow::particles::afterIteration
bool afterIteration() override
This is called in time loop, after iterate.
Definition: particles.cpp:110
pFlow::observer::addToSubscriber
void addToSubscriber(const subscriber *subscrbr, message msg)
Definition: observer.cpp:67
pFlow::objectFile
Definition: objectFile.hpp:30
pFlow::particles::boundingSphereMinMax
virtual void boundingSphereMinMax(real &minDiam, real &maxDiam) const =0
Definition: particles.cpp:116