mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-22 16:28:30 +00:00
sphereParticles tested on CPU, iteration, write to file, particle deletion
This commit is contained in:
@ -219,11 +219,11 @@ bool pFlow::sphereParticles::initInertia()
|
||||
auto aPointsMask = dynPointStruct().activePointsMaskDevice();
|
||||
auto aRange = aPointsMask.activeRange();
|
||||
|
||||
auto field_shapeIndex = shapeIndex().fieldDevice();
|
||||
auto field_diameter = diameter_.fieldDevice();
|
||||
auto field_mass = mass_.fieldDevice();
|
||||
auto field_propId = propertyId_.fieldDevice();
|
||||
auto field_I = I_.fieldDevice();
|
||||
auto field_shapeIndex = shapeIndex().deviceView();
|
||||
auto field_diameter = diameter_.deviceView();
|
||||
auto field_mass = mass_.deviceView();
|
||||
auto field_propId = propertyId_.deviceView();
|
||||
auto field_I = I_.deviceView();
|
||||
|
||||
// get info from spheres shape
|
||||
realVector_D d("diameter", spheres_.boundingDiameter());
|
||||
@ -231,10 +231,10 @@ bool pFlow::sphereParticles::initInertia()
|
||||
uint32Vector_D propId("propId", spheres_.shapePropertyIds());
|
||||
realVector_D I("I", spheres_.Inertia());
|
||||
|
||||
auto d_d = d.deviceVector();
|
||||
auto d_mass = mass.deviceVector();
|
||||
auto d_propId = propId.deviceVector();
|
||||
auto d_I = I.deviceVector();
|
||||
auto d_d = d.deviceView();
|
||||
auto d_mass = mass.deviceView();
|
||||
auto d_propId = propId.deviceView();
|
||||
auto d_I = I.deviceView();
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"particles::initInertia",
|
||||
@ -385,7 +385,7 @@ pFlow::sphereParticles::sphereParticles(
|
||||
auto index = indexHD.indicesHost();
|
||||
|
||||
realx3Vector rvel(n,RESERVE());
|
||||
const auto hrVel = rVelocity_.hostVector();
|
||||
const auto hrVel = rVelocity_.hostView();
|
||||
|
||||
for(auto i=0; i<n; i++)
|
||||
{
|
||||
@ -464,7 +464,7 @@ bool pFlow::sphereParticles::beforeIteration()
|
||||
rVelIntegration_().predict(dt(),rVelocity_, rAcceleration_);
|
||||
intPredictTimer_.end();
|
||||
|
||||
WARNING<<"pFlow::sphereParticles::beforeIteration()"<<END_WARNING;
|
||||
//WARNING<<"pFlow::sphereParticles::beforeIteration()"<<END_WARNING;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -475,13 +475,13 @@ bool pFlow::sphereParticles::iterate()
|
||||
accelerationTimer_.start();
|
||||
pFlow::sphereParticlesKernels::acceleration(
|
||||
control().g(),
|
||||
mass().fieldDevice(),
|
||||
contactForce().fieldDevice(),
|
||||
I().fieldDevice(),
|
||||
contactTorque().fieldDevice(),
|
||||
mass().deviceView(),
|
||||
contactForce().deviceView(),
|
||||
I().deviceView(),
|
||||
contactTorque().deviceView(),
|
||||
dynPointStruct().activePointsMaskDevice(),
|
||||
accelertion().fieldDevice(),
|
||||
rAcceleration().fieldDevice()
|
||||
accelertion().deviceView(),
|
||||
rAcceleration().deviceView()
|
||||
);
|
||||
accelerationTimer_.end();
|
||||
|
||||
|
@ -78,16 +78,28 @@ pFlow::dynamicPointStructure::dynamicPointStructure
|
||||
|
||||
}
|
||||
|
||||
bool pFlow::dynamicPointStructure::predict
|
||||
(
|
||||
real dt,
|
||||
realx3PointField_D& acceleration
|
||||
)
|
||||
/*bool pFlow::dynamicPointStructure::beforeIteration()
|
||||
{
|
||||
//auto& pos = pStruct().pointPosition();
|
||||
pointStructure::beforeIteration();
|
||||
auto& acc = time().lookupObject<realx3PointField_D>("acceleration");
|
||||
return predict(dt(), acc);
|
||||
}*/
|
||||
|
||||
//if(!integrationPos_().predict(dt, pos.VectorField(), velocity_.VectorField() ))return false;
|
||||
//if(!integrationVel_().predict(dt, velocity_.VectorField(), acceleration.VectorField()))return false;
|
||||
/*bool pFlow::dynamicPointStructure::iterate()
|
||||
{
|
||||
pointStructure::iterate();
|
||||
auto& acc = time().lookupObject<realx3PointField_D>("acceleration");
|
||||
return correct(dt(), acc);
|
||||
|
||||
}*/
|
||||
|
||||
bool pFlow::dynamicPointStructure::predict(
|
||||
real dt,
|
||||
realx3PointField_D &acceleration)
|
||||
{
|
||||
|
||||
if(!integrationPos_().predict(dt, pointPosition(), velocity_ ))return false;
|
||||
if(!integrationVel_().predict(dt, velocity_, acceleration))return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -100,9 +112,9 @@ bool pFlow::dynamicPointStructure::correct
|
||||
{
|
||||
//auto& pos = pStruct().pointPosition();
|
||||
|
||||
//if(!integrationPos_().correct(dt, pos.VectorField(), velocity_.VectorField() ))return false;
|
||||
if(!integrationPos_().correct(dt, pointPosition(), velocity_) )return false;
|
||||
|
||||
//if(!integrationVel_().correct(dt, velocity_.VectorField(), acceleration.VectorField()))return false;
|
||||
if(!integrationVel_().correct(dt, velocity_, acceleration))return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -121,7 +133,7 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::dynamicPointStructure::inser
|
||||
|
||||
if(!integrationPos_().needSetInitialVals()) return newIndicesPtr;
|
||||
|
||||
auto hVel = velocity_.hostVector();
|
||||
auto hVel = velocity_.hostView();
|
||||
auto n = newIndicesPtr().size();
|
||||
auto index = newIndicesPtr().indicesHost();
|
||||
|
||||
@ -158,8 +170,8 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::dynamicPointStructure::inser
|
||||
|
||||
realx3Vector pos(n,RESERVE());
|
||||
realx3Vector vel(n,RESERVE());
|
||||
const auto hVel = velocity().hostVector();
|
||||
const auto hPos = pStruct().pointPosition().hostVector();
|
||||
const auto hVel = velocity().hostView();
|
||||
const auto hPos = pStruct().pointPosition().hostView();
|
||||
|
||||
for(auto i=0; i<n; i++)
|
||||
{
|
||||
|
@ -80,10 +80,14 @@ public:
|
||||
return velocity_;
|
||||
}
|
||||
|
||||
/*inline auto velocityHostAll()
|
||||
{
|
||||
return velocity_.hostVectorAll();
|
||||
}*/
|
||||
/// In the time loop before iterate
|
||||
//bool beforeIteration() override;
|
||||
|
||||
/// @brief This is called in time loop. Perform the main calculations
|
||||
/// when the component should evolve along time.
|
||||
//bool iterate() override;
|
||||
|
||||
|
||||
|
||||
bool predict(real dt, realx3PointField_D& acceleration);
|
||||
|
||||
|
Reference in New Issue
Block a user