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

grainParticles.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 __grainParticles_hpp__
#define __grainParticles_hpp__
#include "indexContainer.hpp"
#include "particles.hpp"
#include "property.hpp"
#include "grainShape.hpp"
#include "boundaryGrainParticlesList.hpp"
#include "systemControl.hpp"
namespace pFlow
{
class grainParticles : public particles
{
public:
using ShapeType = grainShape;
private:
ShapeType grains_;
uint32PointField_D propertyId_;
realPointField_D grainDiameter_;
realPointField_D coarseGrainFactor_;
realPointField_D mass_;
realPointField_D I_;
realx3PointField_D rVelocity_;
realx3PointField_D rAcceleration_;
boundaryGrainParticlesList boundaryGrainParticles_;
uniquePtr<integration> rVelIntegration_ = nullptr;
Timer accelerationTimer_;
Timer intPredictTimer_;
Timer intCorrectTimer_;
Timer fieldUpdateTimer_;
private:
bool getParticlesInfoFromShape(
const wordVector& shapeNames,
uint32Vector& propIds,
realVector& diams,
realVector& coarseGrainFactors,
realVector& m,
realVector& Is,
uint32Vector& shIndex
);
protected:
Timer& accelerationTimer()
{
return accelerationTimer_;
}
Timer& intCorrectTimer()
{
return intCorrectTimer_;
}
integration& rVelIntegration()
{
return rVelIntegration_();
}
public:
grainParticles(systemControl& control, const property& prop);
~grainParticles() override = default;
/*bool insertParticles
(
const realx3Vector& position,
const wordVector& shapes,
const setFieldList& setField
) override ;*/
// TODO: make this method private later
bool initializeParticles();
const auto& grains() const
{
return grains_;
}
const auto& I() const
{
return I_;
}
auto& I()
{
return I_;
}
const auto& rVelocity() const
{
return rVelocity_;
}
auto& rVelocity()
{
return rVelocity_;
}
bool hearChanges(
real t,
real dt,
uint32 iter,
const message& msg,
const anyList& varList
) override
{
notImplementedFunction;
return false;
}
const uint32PointField_D& propertyId() const override
{
return propertyId_;
}
const realPointField_D& diameter() const override
{
return grainDiameter_;
}
const realPointField_D& grainDiameter()const
{
return grainDiameter_;
}
const realPointField_D& coarseGrainFactor() const
{
return coarseGrainFactor_;
}
const realPointField_D& mass() const override
{
return mass_;
}
bool beforeIteration() override;
bool iterate() override;
bool insertParticles(
const realx3Vector& position,
const wordVector& shapesNames,
const anyList& setVarList
) override;
realx3PointField_D& rAcceleration() override
{
return rAcceleration_;
}
const realx3PointField_D& rAcceleration() const override
{
return rAcceleration_;
}
const realPointField_D& boundingSphere() const override
{
return diameter();
}
word shapeTypeName() const override;
const shape& getShapes() const override;
void boundingSphereMinMax(real& minDiam, real& maxDiam) const override;
};// grainParticles
} // pFlow
#endif //__sphereParticles_hpp__
pFlow::grainParticles::mass_
realPointField_D mass_
mass of particles field
Definition: grainParticles.hpp:63
notImplementedFunction
#define notImplementedFunction
Report that a function is yet not implemented.
Definition: error.hpp:84
pFlow::grainParticles::rVelocity_
realx3PointField_D rVelocity_
pointField of rotational Velocity of particles on device
Definition: grainParticles.hpp:69
pFlow::grainParticles::~grainParticles
~grainParticles() override=default
pFlow::grainParticles::grains_
ShapeType grains_
reference to shapes
Definition: grainParticles.hpp:51
pFlow::grainParticles::insertParticles
bool insertParticles(const realx3Vector &position, const wordVector &shapesNames, const anyList &setVarList) override
Definition: grainParticles.cpp:345
pFlow::message
Definition: message.hpp:33
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::grainParticles::intPredictTimer_
Timer intPredictTimer_
timer for integration computations (prediction step)
Definition: grainParticles.hpp:84
pFlow::grainParticles::getShapes
const shape & getShapes() const override
Definition: grainParticles.cpp:409
pFlow::demComponent::control
const auto & control() const
Const ref to systemControl.
Definition: demComponent.hpp:88
pFlow::boundaryGrainParticlesList
Definition: boundaryGrainParticlesList.hpp:13
pFlow::integration
Base class for integrating the first order ODE (IVP)
Definition: integration.hpp:51
systemControl.hpp
pFlow::grainParticles::grainDiameter_
realPointField_D grainDiameter_
diameter / boundig sphere size of particles on device
Definition: grainParticles.hpp:57
pFlow::grainParticles::propertyId_
uint32PointField_D propertyId_
property id on device
Definition: grainParticles.hpp:54
pFlow::grainParticles
Definition: grainParticles.hpp:42
pFlow::grainParticles::shapeTypeName
word shapeTypeName() const override
Definition: grainParticles.cpp:404
pFlow::uint32
unsigned int uint32
Definition: builtinTypes.hpp:56
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::systemControl
Definition: systemControl.hpp:41
pFlow::grainParticles::intCorrectTimer_
Timer intCorrectTimer_
timer for integration computations (correction step)
Definition: grainParticles.hpp:87
pFlow::grainParticles::iterate
bool iterate() override
iterate particles
Definition: grainParticles.cpp:301
particles.hpp
pFlow::grainParticles::diameter
const realPointField_D & diameter() const override
Definition: grainParticles.hpp:191
pFlow::grainParticles::I
const auto & I() const
const reference to inertia pointField
Definition: grainParticles.hpp:153
pFlow::grainParticles::getParticlesInfoFromShape
bool getParticlesInfoFromShape(const wordVector &shapeNames, uint32Vector &propIds, realVector &diams, realVector &coarseGrainFactors, realVector &m, realVector &Is, uint32Vector &shIndex)
Definition: grainParticles.cpp:88
pFlow::grainParticles::initializeParticles
bool initializeParticles()
Insert new particles in position with specified shapes.
Definition: grainParticles.cpp:26
pFlow::grainParticles::fieldUpdateTimer_
Timer fieldUpdateTimer_
Definition: grainParticles.hpp:89
pFlow
Definition: demGeometry.hpp:27
pFlow::grainParticles::propertyId
const uint32PointField_D & propertyId() const override
Definition: grainParticles.hpp:186
pFlow::grainParticles::grains
const auto & grains() const
const reference to shapes object
Definition: grainParticles.hpp:147
pFlow::grainParticles::hearChanges
bool hearChanges(real t, real dt, uint32 iter, const message &msg, const anyList &varList) override
Definition: grainParticles.hpp:174
pFlow::grainParticles::boundingSphere
const realPointField_D & boundingSphere() const override
Definition: grainParticles.hpp:234
pFlow::grainParticles::mass
const realPointField_D & mass() const override
Definition: grainParticles.hpp:207
pFlow::grainParticles::I
auto & I()
reference to inertia pointField
Definition: grainParticles.hpp:159
pFlow::pointField
Definition: pointField.hpp:33
pFlow::grainParticles::I_
realPointField_D I_
pointField of inertial of particles
Definition: grainParticles.hpp:66
pFlow::grainParticles::rVelIntegration
integration & rVelIntegration()
Definition: grainParticles.hpp:116
pFlow::anyList
Definition: anyList.hpp:35
pFlow::grainParticles::boundingSphereMinMax
void boundingSphereMinMax(real &minDiam, real &maxDiam) const override
Definition: grainParticles.cpp:415
pFlow::grainParticles::rAcceleration_
realx3PointField_D rAcceleration_
pointField of rotational acceleration of particles on device
Definition: grainParticles.hpp:72
pFlow::particles
Definition: particles.hpp:33
grainShape.hpp
pFlow::shape
Definition: shape.hpp:30
pFlow::Timer
Definition: Timer.hpp:33
pFlow::grainParticles::beforeIteration
bool beforeIteration() override
before iteration step
Definition: grainParticles.cpp:278
pFlow::grainParticles::rVelIntegration_
uniquePtr< integration > rVelIntegration_
rotational velocity integrator
Definition: grainParticles.hpp:78
pFlow::grainParticles::rAcceleration
const realx3PointField_D & rAcceleration() const override
Definition: grainParticles.hpp:229
pFlow::grainParticles::accelerationTimer_
Timer accelerationTimer_
timer for acceleration computations
Definition: grainParticles.hpp:81
boundaryGrainParticlesList.hpp
pFlow::property
property holds the pure properties of materials.
Definition: property.hpp:37
pFlow::grainParticles::coarseGrainFactor_
realPointField_D coarseGrainFactor_
Definition: grainParticles.hpp:59
pFlow::grainParticles::coarseGrainFactor
const realPointField_D & coarseGrainFactor() const
Definition: grainParticles.hpp:201
pFlow::grainParticles::rVelocity
const auto & rVelocity() const
Definition: grainParticles.hpp:164
pFlow::grainParticles::grainParticles
grainParticles(systemControl &control, const property &prop)
construct from systemControl and property
Definition: grainParticles.cpp:143
pFlow::grainParticles::rAcceleration
realx3PointField_D & rAcceleration() override
Definition: grainParticles.hpp:224
pFlow::uniquePtr
Definition: uniquePtr.hpp:42
pFlow::grainShape
Definition: grainShape.hpp:29
pFlow::grainParticles::grainDiameter
const realPointField_D & grainDiameter() const
Definition: grainParticles.hpp:196
property.hpp
pFlow::grainParticles::intCorrectTimer
Timer & intCorrectTimer()
Definition: grainParticles.hpp:111
pFlow::grainParticles::rVelocity
auto & rVelocity()
Definition: grainParticles.hpp:169
pFlow::grainParticles::boundaryGrainParticles_
boundaryGrainParticlesList boundaryGrainParticles_
boundaries
Definition: grainParticles.hpp:75
pFlow::demComponent::dt
real dt() const
Time step of integration.
Definition: demComponent.cpp:33
pFlow::grainParticles::accelerationTimer
Timer & accelerationTimer()
Definition: grainParticles.hpp:106
pFlow::Vector< word >
m
uint32 m
Definition: NBSLoop.hpp:22
indexContainer.hpp