Go to the documentation of this file.
30 using policy = Kokkos::RangePolicy<
32 Kokkos::IndexType<uint32>>;
39 "the maximum value of shapeIndex is "<< maxIndex <<
40 " which is not valid."<<
endl;
45 auto aRange = aPointsMask.activeRange();
47 auto field_shapeIndex =
shapeIndex().deviceView();
65 auto d_I =
I.deviceView();
68 "particles::initInertia",
69 policy(aRange.start(), aRange.end()),
74 uint32 index = field_shapeIndex[i];
75 field_I[i] = d_I[index];
76 field_diameter[i] = d_d[index];
77 field_coarseGrainFactor[i] = d_coarseGrainFactor[index];
78 field_mass[i] = d_mass[index];
79 field_propId[i] = d_propId[index];
99 auto numNew =
static_cast<uint32>(shapeNames.
size());
107 coarseGrainFactors.clear();
108 coarseGrainFactors.
reserve(numNew);
120 for(
const auto& name:shapeNames)
123 if(grains_.shapeNameToIndex(name,indx))
125 shIndex.push_back(indx);
126 Is.push_back( grains_.Inertia(indx));
127 m.push_back(grains_.mass(indx));
128 diams.push_back(grains_.boundingDiameter(indx));
129 coarseGrainFactors.push_back(grains_.coarseGrainFactor(indx));
130 propIds.push_back( grains_.propertyId(indx));
135 "does not exist. The list is "<<grains_.shapeNameList()<<
endl;
152 &control.caseSetup(),
207 static_cast<
real>(0.0000000001)
232 boundaryGrainParticles_
234 dynPointStruct().boundaries(),
238 "Acceleration", &this->timers() ),
240 "Integration-predict", &this->timers() ),
242 "Integration-correct", &this->timers() ),
244 "fieldUpdate", &this->timers() )
247 auto intMethod =
control.settingsDict().getVal<
word>(
"integrationMethod");
262 " error in creating integration object for rVelocity. \n";
281 intPredictTimer_.start();
282 auto dt = this->dt();
283 dynPointStruct().predict(dt, accelertion());
284 rVelIntegration_().predict(dt,rVelocity_, rAcceleration_);
285 intPredictTimer_.end();
287 fieldUpdateTimer_.start();
288 propertyId_.updateBoundariesSlaveToMasterIfRequested();
289 grainDiameter_.updateBoundariesSlaveToMasterIfRequested();
290 coarseGrainFactor_.updateBoundariesSlaveToMasterIfRequested();
291 mass_.updateBoundariesSlaveToMasterIfRequested();
292 I_.updateBoundariesSlaveToMasterIfRequested();
293 rVelocity_.updateBoundariesSlaveToMasterIfRequested();
294 rAcceleration_.updateBoundariesSlaveToMasterIfRequested();
295 rVelIntegration_().updateBoundariesSlaveToMasterIfRequested();
296 fieldUpdateTimer_.end();
308 accelerationTimer_.start();
311 mass().deviceViewAll(),
312 contactForce().deviceViewAll(),
314 contactTorque().deviceViewAll(),
315 dynPointStruct().activePointsMaskDevice(),
316 accelertion().deviceViewAll(),
317 rAcceleration().deviceViewAll()
319 for(
auto& bndry:boundaryGrainParticles_)
321 bndry->acceleration(ti, g);
323 accelerationTimer_.end();
325 intCorrectTimer_.start();
327 if(!dynPointStruct().correct(dt(), accelertion()))
331 if(!rVelIntegration_().correct(
339 intCorrectTimer_.end();
351 anyList newVarList(setVarList);
356 realVector coarseGrainFactor(
"coarseGrainFactor");
360 if(!getParticlesInfoFromShape(
373 mass_.name()+
"Vector",
381 grainDiameter_.name()+
"Vector",
382 std::move(diameter));
385 coarseGrainFactor_.name()+
"Vector",
386 std::move(coarseGrainFactor));
389 propertyId_.name()+
"Vector",
393 shapeIndex().name()+
"Vector",
394 std::move(shapeIdx));
396 if(!dynPointStruct().insertPoints(position, newVarList))
420 minDiam = grains_.minBoundingSphere();
421 maxDiam = grains_.maxBoundingSphere();
Pair< T, T > minMax(const internalField< T, MemorySpace > &iField)
realPointField_D mass_
mass of particles field
bool beforeIteration() override
This is called in time loop, before iterate.
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)
bool iterate() override
This is called in time loop.
realx3PointField_D rVelocity_
pointField of rotational Velocity of particles on device
real coarseGrainFactor(uint32 index) const
ShapeType grains_
reference to shapes
bool insertParticles(const realx3Vector &position, const wordVector &shapesNames, const anyList &setVarList) override
#define fatalExit
Fatal exit.
const shape & getShapes() const override
const auto & control() const
Const ref to systemControl.
realPointField_D grainDiameter_
diameter / boundig sphere size of particles on device
uint32PointField_D propertyId_
property id on device
void reserve(size_t cap)
Reserve capacity for vector Preserve the content.
word shapeTypeName() const override
bool indexValid(uint32 index) const
const auto & shapePropertyIds() const
bool iterate() override
iterate particles
auto size() const
Size of the vector.
iOstream & endl(iOstream &os)
Add newline and flush stream.
const auto & I() const
const reference to inertia pointField
bool getParticlesInfoFromShape(const wordVector &shapeNames, uint32Vector &propIds, realVector &diams, realVector &coarseGrainFactors, realVector &m, realVector &Is, uint32Vector &shIndex)
bool initializeParticles()
Insert new particles in position with specified shapes.
Kokkos::RangePolicy< pFlow::DefaultExecutionSpace, Kokkos::Schedule< Kokkos::Static >, Kokkos::IndexType< pFlow::uint32 > > policy
typename InternalFieldType::execution_space execution_space
INLINE_FUNCTION_H auto deviceView() const
Device view range [0, size)
const realPointField_D & mass() const override
realPointField_D I_
pointField of inertial of particles
void boundingSphereMinMax(real &minDiam, real &maxDiam) const override
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
const FieldType & field() const
bool beforeIteration() override
before iteration step
bool Inertia(uint32 index, real &I) const override
uniquePtr< integration > rVelIntegration_
rotational velocity integrator
const char *const shapeFile__
bool mass(uint32 index, real &m) const override
property holds the pure properties of materials.
realPointField_D coarseGrainFactor_
const realPointField_D & coarseGrainFactor() const
grainParticles(systemControl &control, const property &prop)
construct from systemControl and property
bool boundingDiameter(uint32 index, real &bDiam) const override
static uniquePtr< integration > create(const word &baseName, pointStructure &pStruct, const word &method, const realx3Field_D &initialValField)
Create the polymorphic object based on inputs.
reference emplaceBack(const word &name, Args &&... args)
Create variable using constructor in-place.