www.cemf.ir
dynamicPointStructure.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 
22 #include "systemControl.hpp"
23 
25 (
26  systemControl& control
27 )
28 :
29  pointStructure(control),
30  velocity_
31  (
32  objectFile(
33  "velocity",
34  "",
35  objectFile::READ_ALWAYS,
36  objectFile::WRITE_ALWAYS
37  ),
38  *this,
39  zero3
40  ),
41  velocityUpdateTimer_("velocity boundary update", &timers()),
42  integrationMethod_
43  (
44  control.settingsDict().getVal<word>("integrationMethod")
45  )
46 {
47  REPORT(1)<< "Creating integration method "<<
48  Green_Text(integrationMethod_)<<" for dynamicPointStructure."<<END_REPORT;
49 
50  integrationPos_ = integration::create
51  (
52  "pStructPosition",
53  *this,
54  integrationMethod_,
55  pointPosition()
56  );
57 
58  if( !integrationPos_ )
59  {
61  " error in creating integration object for dynamicPointStructure (position). \n";
62  fatalExit;
63  }
64 
65  integrationVel_ = integration::create
66  (
67  "pStructVelocity",
68  *this,
69  integrationMethod_,
70  velocity_.field()
71  );
72 
73  if( !integrationVel_ )
74  {
76  " error in creating integration object for dynamicPointStructure (velocity). \n";
77  fatalExit;
78  }
79 
80 }
81 
82 
84 {
85  if(!pointStructure::beforeIteration())return false;
88  integrationPos_->updateBoundariesSlaveToMasterIfRequested();
89  integrationVel_->updateBoundariesSlaveToMasterIfRequested();
91  return true;
92 }
93 
95 {
96  return pointStructure::iterate();
97 
98  /*real dt = this->dt();
99 
100  auto& acc = time().lookupObject<realx3PointField_D>("acceleration");
101  return correct(dt, acc);*/
102 }
103 
105  real dt,
107 {
108 
109  if(!integrationPos_().predict(dt, pointPosition(), velocity_ ))return false;
110  if(!integrationVel_().predict(dt, velocity_, acceleration))return false;
111 
112  return true;
113 }
114 
116 (
117  real dt,
119 )
120 {
121  //auto& pos = pStruct().pointPosition();
122 
123  if(!integrationPos_().correctPStruct(dt, *this, velocity_) )return false;
124 
125  if(!integrationVel_().correct(dt, velocity_, acceleration))return false;
126 
127  return true;
128 }
Green_Text
#define Green_Text(text)
Definition: iOstream.hpp:42
pFlow::grainParticlesKernels::acceleration
void acceleration(const realx3 &g, const deviceViewType1D< real > &mass, const deviceViewType1D< realx3 > &force, const deviceViewType1D< real > &I, const deviceViewType1D< realx3 > &torque, const pFlagTypeDevice &incld, deviceViewType1D< realx3 > lAcc, deviceViewType1D< realx3 > rAcc)
Definition: grainParticlesKernels.cpp:62
pFlow::real
float real
Definition: builtinTypes.hpp:45
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
REPORT
#define REPORT(n)
Definition: streams.hpp:39
pFlow::Timer::start
void start()
Definition: Timer.hpp:105
pFlow::pointStructure::beforeIteration
bool beforeIteration() override
In the time loop before iterate.
Definition: pointStructure.cpp:175
pFlow::dynamicPointStructure::velocity_
realx3PointField_D velocity_
Definition: dynamicPointStructure.hpp:41
systemControl.hpp
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::systemControl
Definition: systemControl.hpp:41
pFlow::dynamicPointStructure::iterate
bool iterate() override
This is called in time loop.
Definition: dynamicPointStructure.cpp:94
pFlow::dynamicPointStructure::dynamicPointStructure
dynamicPointStructure(systemControl &control)
Definition: dynamicPointStructure.cpp:25
pFlow::zero3
const realx3 zero3(0.0)
Definition: types.hpp:137
pFlow::dynamicPointStructure::beforeIteration
bool beforeIteration() override
In the time loop before iterate.
Definition: dynamicPointStructure.cpp:83
pFlow::dynamicPointStructure::predict
bool predict(real dt, realx3PointField_D &acceleration)
prediction step (if any), is called in beforeIteration
Definition: dynamicPointStructure.cpp:104
pFlow::Timer::end
void end()
Definition: Timer.hpp:129
pFlow::pointField
Definition: pointField.hpp:33
pFlow::pointStructure
Definition: pointStructure.hpp:34
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
pFlow::dynamicPointStructure::correct
bool correct(real dt, realx3PointField_D &acceleration)
correction step, is called in iterate
Definition: dynamicPointStructure.cpp:116
pFlow::systemControl::settingsDict
const fileDictionary & settingsDict() const
Definition: systemControl.hpp:157
pFlow::dynamicPointStructure::integrationVel_
uniquePtr< integration > integrationVel_
Definition: dynamicPointStructure.hpp:45
END_REPORT
#define END_REPORT
Definition: streams.hpp:40
pFlow::objectFile
Definition: objectFile.hpp:30
pFlow::dynamicPointStructure::velocityUpdateTimer_
Timer velocityUpdateTimer_
Definition: dynamicPointStructure.hpp:47
pFlow::dictionary::getVal
T getVal(const word &keyword) const
get the value of data entry
Definition: dictionary.hpp:379
pFlow::pointStructure::iterate
bool iterate() override
This is called in time loop.
Definition: pointStructure.cpp:232
dynamicPointStructure.hpp
pFlow::pointField::updateBoundariesSlaveToMasterIfRequested
void updateBoundariesSlaveToMasterIfRequested()
update boundaries if it is requested previousely (slave to master).
Definition: pointField.hpp:115
pFlow::dynamicPointStructure::integrationPos_
uniquePtr< integration > integrationPos_
Definition: dynamicPointStructure.hpp:43