Go to the documentation of this file.
205 using policy = Kokkos::RangePolicy<
207 Kokkos::IndexType<uint32>>;
214 "the maximum value of shapeIndex is "<< maxIndex <<
215 " which is not valid."<<
endl;
220 auto aRange = aPointsMask.activeRange();
222 auto field_shapeIndex =
shapeIndex().deviceView();
237 auto d_I =
I.deviceView();
239 Kokkos::parallel_for(
240 "particles::initInertia",
241 policy(aRange.start(), aRange.end()),
246 uint32 index = field_shapeIndex[i];
247 field_I[i] = d_I[index];
248 field_diameter[i] = d_d[index];
249 field_mass[i] = d_mass[index];
250 field_propId[i] = d_propId[index];
268 auto numNew =
static_cast<uint32>(shapeNames.
size());
286 for(
const auto& name:shapeNames)
289 if(spheres_.shapeNameToIndex(name,indx))
291 shIndex.push_back(indx);
292 Is.push_back( spheres_.Inertia(indx));
293 m.push_back(spheres_.mass(indx));
294 diams.push_back(spheres_.boundingDiameter(indx));
295 propIds.push_back( spheres_.propertyId(indx));
300 "does not exist. The list is "<<spheres_.shapeNameList()<<
endl;
317 &control.caseSetup(),
362 static_cast<
real>(0.0000000001)
387 boundarySphereParticles_
389 dynPointStruct().boundaries(),
393 "Acceleration", &this->timers() ),
395 "Integration-predict", &this->timers() ),
397 "Integration-correct", &this->timers() ),
399 "fieldUpdate", &this->timers() )
402 auto intMethod =
control.settingsDict().getVal<
word>(
"integrationMethod");
417 " error in creating integration object for rVelocity. \n";
518 intPredictTimer_.start();
519 auto dt = this->dt();
520 dynPointStruct().predict(dt, accelertion());
521 rVelIntegration_().predict(dt,rVelocity_, rAcceleration_);
522 intPredictTimer_.end();
524 fieldUpdateTimer_.start();
525 propertyId_.updateBoundariesSlaveToMasterIfRequested();
526 diameter_.updateBoundariesSlaveToMasterIfRequested();
527 mass_.updateBoundariesSlaveToMasterIfRequested();
528 I_.updateBoundariesSlaveToMasterIfRequested();
529 rVelocity_.updateBoundariesSlaveToMasterIfRequested();
530 rAcceleration_.updateBoundariesSlaveToMasterIfRequested();
531 rVelIntegration_().updateBoundariesSlaveToMasterIfRequested();
532 fieldUpdateTimer_.end();
544 accelerationTimer_.start();
547 mass().deviceViewAll(),
548 contactForce().deviceViewAll(),
550 contactTorque().deviceViewAll(),
551 dynPointStruct().activePointsMaskDevice(),
552 accelertion().deviceViewAll(),
553 rAcceleration().deviceViewAll()
555 for(
auto& bndry:boundarySphereParticles_)
557 bndry->acceleration(ti, g);
559 accelerationTimer_.end();
561 intCorrectTimer_.start();
563 if(!dynPointStruct().correct(dt(), accelertion()))
567 if(!rVelIntegration_().correct(
575 intCorrectTimer_.end();
587 anyList newVarList(setVarList);
595 if(!getParticlesInfoFromShape(
607 mass_.name()+
"Vector",
615 diameter_.name()+
"Vector",
616 std::move(diameter));
619 propertyId_.name()+
"Vector",
623 shapeIndex().name()+
"Vector",
624 std::move(shapeIdx));
626 if(!dynPointStruct().insertPoints(position, newVarList))
650 minDiam = spheres_.minBoundingSphere();
651 maxDiam = spheres_.maxBoundingSphere();
Pair< T, T > minMax(const internalField< T, MemorySpace > &iField)
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)
uint32PointField_D propertyId_
property id on device
const realPointField_D & mass() const override
bool beforeIteration() override
This is called in time loop, before iterate.
bool iterate() override
This is called in time loop.
realPointField_D diameter_
diameter / boundig sphere size of particles on device
#define fatalExit
Fatal exit.
realx3PointField_D rVelocity_
pointField of rotational Velocity of particles on device
const auto & control() const
Const ref to systemControl.
const shape & getShapes() const override
bool insertParticles(const realx3Vector &position, const wordVector &shapesNames, const anyList &setVarList) override
bool getParticlesInfoFromShape(const wordVector &shapeNames, uint32Vector &propIds, realVector &diams, realVector &m, realVector &Is, uint32Vector &shIndex)
void reserve(size_t cap)
Reserve capacity for vector Preserve the content.
void boundingSphereMinMax(real &minDiam, real &maxDiam) const override
bool indexValid(uint32 index) const
const auto & shapePropertyIds() const
sphereParticles(systemControl &control, const property &prop)
construct from systemControl and property
auto size() const
Size of the vector.
iOstream & endl(iOstream &os)
Add newline and flush stream.
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)
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
bool Inertia(uint32 index, real &I) const override
const auto & I() const
const reference to inertia pointField
const FieldType & field() const
word shapeTypeName() const override
bool boundingDiameter(uint32 index, real &bDiam) const override
bool iterate() override
iterate particles
const char *const shapeFile__
bool initializeParticles()
Insert new particles in position with specified shapes.
bool beforeIteration() override
before iteration step
property holds the pure properties of materials.
uniquePtr< integration > rVelIntegration_
rotational velocity integrator
bool mass(uint32 index, real &m) const override
realPointField_D mass_
mass of particles field
ShapeType spheres_
reference to shapes
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.
realPointField_D I_
pointField of inertial of particles