# PhasicFlow: src/Particles/particles/particles.hpp 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.hpp
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.
-----------------------------------------------------------------------------*/
#ifndef __particles_hpp__
#define __particles_hpp__
#include "demComponent.hpp"
#include "dynamicPointStructure.hpp"
#include "particleIdHandler.hpp"
#include "shape.hpp"
namespace pFlow
{
class particles
: public observer
, public demComponent
{
private:
dynamicPointStructure dynPointStruct_;
uint32PointField_D shapeIndex_;
realx3PointField_D accelertion_;
realx3PointField_D contactForce_;
realx3PointField_D contactTorque_;
uniquePtr<particleIdHandler> idHandler_ = nullptr;
Timer baseFieldBoundaryUpdateTimer_;
static inline const message defaultMessage_{ message::DEFAULT };
protected:
void zeroForce()
{
contactForce_.fill(zero3);
}
void zeroTorque()
{
contactTorque_.fill(zero3);
}
inline auto& dynPointStruct()
{
return dynPointStruct_;
}
inline auto& pointPosition()
{
return dynPointStruct_.pointPosition();
}
inline auto& idHandler()
{
return idHandler_();
}
inline auto& shapeIndex()
{
return shapeIndex_;
}
public:
// type info
TypeInfo("particles");
explicit particles(systemControl& control);
inline const auto& dynPointStruct() const
{
return dynPointStruct_;
}
inline const pointStructure& pStruct() const
{
return dynPointStruct_;
}
inline const auto& simDomain() const
{
return dynPointStruct_.simDomain();
}
inline const auto& thisDomain() const
{
return dynPointStruct_.thisDomain();
}
inline const auto& extendedDomain() const
{
return dynPointStruct_.extendedDomain();
}
inline auto size() const
{
return dynPointStruct_.size();
}
inline auto capacity() const
{
return dynPointStruct_.capacity();
}
inline auto numActive() const
{
return dynPointStruct_.numActive();
}
inline bool isAllActive() const
{
return dynPointStruct_.isAllActive();
}
inline const auto& pointPosition() const
{
return dynPointStruct_.pointPosition();
}
inline const auto& velocity() const
{
return dynPointStruct_.velocity();
}
inline const auto& accelertion() const
{
return accelertion_;
}
inline auto& accelertion()
{
return accelertion_;
}
inline auto& contactForce()
{
return contactForce_;
}
inline const auto& contactForce() const
{
return contactForce_;
}
inline auto& contactTorque()
{
return contactTorque_;
}
inline const auto& contactTorque() const
{
return contactTorque_;
}
inline
uint maxId()const
{
return idHandler_().maxId();
}
bool beforeIteration() override;
bool iterate() override;
bool afterIteration() override;
virtual bool insertParticles(
const realx3Vector& position,
const wordVector& shapesNames,
const anyList& setVarList
) = 0;
virtual const uint32PointField_D& propertyId() const = 0;
virtual const realPointField_D& diameter() const = 0;
virtual const realPointField_D& mass() const = 0;
virtual realx3PointField_D& rAcceleration() = 0;
virtual const realx3PointField_D& rAcceleration() const = 0;
virtual const realPointField_D& boundingSphere() const = 0;
virtual word shapeTypeName() const = 0;
virtual const shape& getShapes() const = 0;
virtual void boundingSphereMinMax(real& minDiam, real& maxDiam) const = 0;
}; // particles
} // namespace pFlow
#endif //__particles_hpp__
pFlow::internalPoints::isAllActive
bool isAllActive() const
Definition: internalPoints.hpp:195
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::dynamicPointStructure::velocity
const realx3PointField_D & velocity() const
Definition: dynamicPointStructure.hpp:74
pFlow::particles::velocity
const auto & velocity() const
Definition: particles.hpp:151
pFlow::particles::zeroTorque
void zeroTorque()
Definition: particles.hpp:69
pFlow::particles::accelertion
const auto & accelertion() const
Definition: particles.hpp:156
pFlow::message
Definition: message.hpp:33
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::particles::pointPosition
const auto & pointPosition() const
Definition: particles.hpp:146
pFlow::particles::contactForce
const auto & contactForce() const
Definition: particles.hpp:171
pFlow::demComponent::control
const auto & control() const
Const ref to systemControl.
Definition: demComponent.hpp:88
shape.hpp
pFlow::particles::dynPointStruct
const auto & dynPointStruct() const
Definition: particles.hpp:101
pFlow::pointStructure::thisDomain
const auto & thisDomain() const
Definition: pointStructure.hpp:155
pFlow::particles::contactForce
auto & contactForce()
Definition: particles.hpp:166
pFlow::particles::rAcceleration
virtual realx3PointField_D & rAcceleration()=0
pFlow::particles::shapeTypeName
virtual word shapeTypeName() const =0
pFlow::internalPoints::pointPosition
const PointsType & pointPosition() const
Definition: internalPoints.cpp:209
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::particles::insertParticles
virtual bool insertParticles(const realx3Vector &position, const wordVector &shapesNames, const anyList &setVarList)=0
pFlow::systemControl
Definition: systemControl.hpp:41
pFlow::zero3
const realx3 zero3(0.0)
Definition: types.hpp:137
pFlow::particles::mass
virtual const realPointField_D & mass() const =0
pFlow::particles::capacity
auto capacity() const
Definition: particles.hpp:131
pFlow::particles::thisDomain
const auto & thisDomain() const
Definition: particles.hpp:116
pFlow::pointStructure::simDomain
const auto & simDomain() const
Definition: pointStructure.hpp:149
pFlow::dynamicPointStructure
Definition: dynamicPointStructure.hpp:35
pFlow::particles::extendedDomain
const auto & extendedDomain() const
Definition: particles.hpp:121
pFlow::particles::diameter
virtual const realPointField_D & diameter() const =0
pFlow
Definition: demGeometry.hpp:27
pFlow::particles::dynPointStruct_
dynamicPointStructure dynPointStruct_
dynamic point structure for particles center mass
Definition: particles.hpp:40
pFlow::pointField
Definition: pointField.hpp:33
pFlow::particles::zeroForce
void zeroForce()
Definition: particles.hpp:64
pFlow::particles::shapeIndex_
uint32PointField_D shapeIndex_
shape index of each particle
Definition: particles.hpp:43
pFlow::pointStructure
Definition: pointStructure.hpp:34
pFlow::anyList
Definition: anyList.hpp:35
pFlow::particles::boundingSphere
virtual const realPointField_D & boundingSphere() const =0
pFlow::particles::maxId
uint maxId() const
Definition: particles.hpp:187
pFlow::particles
Definition: particles.hpp:33
pFlow::particles::pointPosition
auto & pointPosition()
Definition: particles.hpp:79
pFlow::internalPoints::numActive
uint32 numActive() const
Definition: internalPoints.hpp:188
pFlow::particles::particles
particles(systemControl &control)
Definition: particles.cpp:22
pFlow::particles::baseFieldBoundaryUpdateTimer_
Timer baseFieldBoundaryUpdateTimer_
Definition: particles.hpp:57
pFlow::shape
Definition: shape.hpp:30
pFlow::particles::simDomain
const auto & simDomain() const
Definition: particles.hpp:111
pFlow::demComponent
A base class for every main component of DEM system.
Definition: demComponent.hpp:42
pFlow::particles::contactTorque
auto & contactTorque()
Definition: particles.hpp:176
pFlow::Timer
Definition: Timer.hpp:33
pFlow::particles::contactForce_
realx3PointField_D contactForce_
contact force field
Definition: particles.hpp:49
pFlow::particles::getShapes
virtual const shape & getShapes() const =0
pFlow::particles::shapeIndex
auto & shapeIndex()
Definition: particles.hpp:89
pFlow::particles::afterIteration
bool afterIteration() override
This is called in time loop, after iterate.
Definition: particles.cpp:110
pFlow::particles::propertyId
virtual const uint32PointField_D & propertyId() const =0
pFlow::particles::size
auto size() const
Definition: particles.hpp:126
pFlow::pointStructure::extendedDomain
const auto & extendedDomain() const
Definition: pointStructure.hpp:161
pFlow::particles::contactTorque
const auto & contactTorque() const
Definition: particles.hpp:181
pFlow::particles::numActive
auto numActive() const
Definition: particles.hpp:136
pFlow::pointField::fill
void fill(const T &val)
Definition: pointField.hpp:138
pFlow::particles::isAllActive
bool isAllActive() const
Definition: particles.hpp:141
pFlow::internalPoints::size
uint32 size() const
Definition: internalPoints.hpp:168
pFlow::particles::defaultMessage_
static const message defaultMessage_
messages for this objects
Definition: particles.hpp:60
dynamicPointStructure.hpp
pFlow::particles::idHandler
auto & idHandler()
Definition: particles.hpp:84
pFlow::particles::accelertion
auto & accelertion()
Definition: particles.hpp:161
demComponent.hpp
pFlow::particles::accelertion_
realx3PointField_D accelertion_
acceleration on device
Definition: particles.hpp:46
pFlow::uniquePtr
Definition: uniquePtr.hpp:42
pFlow::particles::idHandler_
uniquePtr< particleIdHandler > idHandler_
handling new ids for new particles
Definition: particles.hpp:55
pFlow::particles::dynPointStruct
auto & dynPointStruct()
Definition: particles.hpp:74
pFlow::particles::TypeInfo
TypeInfo("particles")
pFlow::particles::pStruct
const pointStructure & pStruct() const
Definition: particles.hpp:106
pFlow::particles::contactTorque_
realx3PointField_D contactTorque_
contact torque field
Definition: particles.hpp:52
particleIdHandler.hpp
pFlow::Vector< realx3 >
pFlow::particles::boundingSphereMinMax
virtual void boundingSphereMinMax(real &minDiam, real &maxDiam) const =0
Definition: particles.cpp:116
pFlow::message::DEFAULT
@ DEFAULT
Definition: message.hpp:38
pFlow::internalPoints::capacity
uint32 capacity() const
Definition: internalPoints.hpp:175