# PhasicFlow: src/Particles/dynamicPointStructure/dynamicPointStructure.cpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

dynamicPointStructure.cpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "dynamicPointStructure.hpp"
#include "systemControl.hpp"
pFlow::dynamicPointStructure::dynamicPointStructure
(
systemControl& control
)
:
pointStructure(control),
velocity_
(
objectFile(
"velocity",
"",
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS
),
*this,
zero3
),
velocityUpdateTimer_("velocity boundary update", &timers()),
integrationMethod_
(
control.settingsDict().getVal<word>("integrationMethod")
)
{
REPORT(1)<< "Creating integration method "<<
Green_Text(integrationMethod_)<<" for dynamicPointStructure."<<END_REPORT;
integrationPos_ = integration::create
(
"pStructPosition",
*this,
integrationMethod_,
pointPosition()
);
if( !integrationPos_ )
{
fatalErrorInFunction<<
" error in creating integration object for dynamicPointStructure (position). \n";
fatalExit;
}
integrationVel_ = integration::create
(
"pStructVelocity",
*this,
integrationMethod_,
velocity_.field()
);
if( !integrationVel_ )
{
fatalErrorInFunction<<
" error in creating integration object for dynamicPointStructure (velocity). \n";
fatalExit;
}
}
bool pFlow::dynamicPointStructure::beforeIteration()
{
if(!pointStructure::beforeIteration())return false;
velocityUpdateTimer_.start();
velocity_.updateBoundariesSlaveToMasterIfRequested();
integrationPos_->updateBoundariesSlaveToMasterIfRequested();
integrationVel_->updateBoundariesSlaveToMasterIfRequested();
velocityUpdateTimer_.end();
return true;
}
bool pFlow::dynamicPointStructure::iterate()
{
return pointStructure::iterate();
/*real dt = this->dt();
auto& acc = time().lookupObject<realx3PointField_D>("acceleration");
return correct(dt, acc);*/
}
bool pFlow::dynamicPointStructure::predict(
real dt,
realx3PointField_D &acceleration)
{
if(!integrationPos_().predict(dt, pointPosition(), velocity_ ))return false;
if(!integrationVel_().predict(dt, velocity_, acceleration))return false;
return true;
}
bool pFlow::dynamicPointStructure::correct
(
real dt,
realx3PointField_D& acceleration
)
{
//auto& pos = pStruct().pointPosition();
if(!integrationPos_().correctPStruct(dt, *this, velocity_) )return false;
if(!integrationVel_().correct(dt, velocity_, acceleration))return false;
return true;
}
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