# PhasicFlow: src/Particles/particles/particles.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.

particles.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 "particles.hpp"
pFlow::particles::particles(systemControl& control)
: observer(defaultMessage_),
demComponent("particles", control),
dynPointStruct_(control),
/*id_(
objectFile(
"id",
"",
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
),
dynPointStruct_,
static_cast<uint32>(-1),
static_cast<uint32>(-1)
),*/
shapeIndex_(
objectFile(
"shapeIndex",
"",
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS
),
dynPointStruct_,
0
),
accelertion_(
objectFile(
"accelertion",
"",
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
),
dynPointStruct_,
zero3
),
contactForce_(
objectFile(
"contactForce",
"",
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
),
dynPointStruct_,
zero3
),
contactTorque_(
objectFile(
"contactTorque",
"",
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
),
dynPointStruct_,
zero3
),
idHandler_(particleIdHandler::create(dynPointStruct_)),
baseFieldBoundaryUpdateTimer_("baseFieldBoundaryUpdate",&timers())
{
this->addToSubscriber(dynPointStruct_);
//idHandler_().initialIdCheck();
}
bool
pFlow::particles::beforeIteration()
{
if( !dynPointStruct_.beforeIteration())
{
return false;
}
zeroForce();
zeroTorque();
baseFieldBoundaryUpdateTimer_.start();
shapeIndex_.updateBoundariesSlaveToMasterIfRequested();
accelertion_.updateBoundariesSlaveToMasterIfRequested();
idHandler_().updateBoundariesSlaveToMasterIfRequested();
baseFieldBoundaryUpdateTimer_.end();
return true;
}
bool
pFlow::particles::iterate()
{
return dynPointStruct_.iterate();
}
bool
pFlow::particles::afterIteration()
{
return dynPointStruct_.afterIteration();
}
void
pFlow::particles::boundingSphereMinMax(real& minDiam, real& maxDiam) const
{
auto& shp = getShapes();
minDiam = shp.minBoundingSphere();
maxDiam = shp.maxBoundingSphere();
}
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