mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-22 16:28:30 +00:00
Particle insertion is added with anyList
- collision check is not active yet. - variable velocity is not active yet. - events and messages are not active yet.
This commit is contained in:
@ -198,7 +198,7 @@ bool pFlow::sphereParticles::initializeParticles()
|
||||
|
||||
}*/
|
||||
|
||||
bool pFlow::sphereParticles::initInertia()
|
||||
bool pFlow::sphereParticles::initializeParticles()
|
||||
{
|
||||
|
||||
using exeSpace = typename realPointField_D::execution_space;
|
||||
@ -255,6 +255,55 @@ bool pFlow::sphereParticles::initInertia()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
pFlow::sphereParticles::getParticlesInfoFromShape(
|
||||
const wordVector& shapeNames,
|
||||
uint32Vector& propIds,
|
||||
realVector& diams,
|
||||
realVector& m,
|
||||
realVector& Is,
|
||||
uint32Vector& shIndex
|
||||
)
|
||||
{
|
||||
auto numNew = static_cast<uint32>(shapeNames.size());
|
||||
|
||||
propIds.clear();
|
||||
propIds.reserve(numNew);
|
||||
|
||||
diams.clear();
|
||||
diams.reserve(numNew);
|
||||
|
||||
m.clear();
|
||||
m.reserve(numNew);
|
||||
|
||||
Is.clear();
|
||||
Is.reserve(numNew);
|
||||
|
||||
shIndex.clear();
|
||||
shIndex.reserve(numNew);
|
||||
|
||||
|
||||
for(const auto& name:shapeNames)
|
||||
{
|
||||
uint32 indx;
|
||||
if(spheres_.shapeNameToIndex(name,indx))
|
||||
{
|
||||
shIndex.push_back(indx);
|
||||
Is.push_back( spheres_.Inertia(indx));
|
||||
m.push_back(spheres_.mass(indx));
|
||||
diams.push_back(spheres_.boundingDiameter(indx));
|
||||
propIds.push_back( spheres_.propertyId(indx));
|
||||
}
|
||||
else
|
||||
{
|
||||
fatalErrorInFunction<<"Shape name "<< name <<
|
||||
"does not exist. The list is "<<spheres_.shapeNameList()<<endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pFlow::sphereParticles::sphereParticles(
|
||||
systemControl &control,
|
||||
@ -364,7 +413,7 @@ pFlow::sphereParticles::sphereParticles(
|
||||
|
||||
WARNING<<"setFields for rVelIntegration_"<<END_WARNING;
|
||||
|
||||
if(!initInertia())
|
||||
if(!initializeParticles())
|
||||
{
|
||||
fatalErrorInFunction;
|
||||
fatalExit;
|
||||
@ -504,6 +553,59 @@ bool pFlow::sphereParticles::iterate()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pFlow::sphereParticles::insertParticles
|
||||
(
|
||||
const realx3Vector &position,
|
||||
const wordVector &shapesNames,
|
||||
const anyList &setVarList
|
||||
)
|
||||
{
|
||||
anyList newVarList(setVarList);
|
||||
|
||||
realVector mass("mass");
|
||||
realVector I("I");
|
||||
realVector diameter("diameter");
|
||||
uint32Vector propId("propId");
|
||||
uint32Vector shapeIdx("shapeIdx");
|
||||
|
||||
if(!getParticlesInfoFromShape(
|
||||
shapesNames,
|
||||
propId,
|
||||
diameter,
|
||||
mass,
|
||||
I,
|
||||
shapeIdx))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
newVarList.emplaceBack(
|
||||
mass_.name()+"Vector",
|
||||
std::move(mass));
|
||||
|
||||
newVarList.emplaceBack(
|
||||
I_.name()+"Vector",
|
||||
std::move(I));
|
||||
|
||||
newVarList.emplaceBack(
|
||||
diameter_.name()+"Vector",
|
||||
std::move(diameter));
|
||||
|
||||
newVarList.emplaceBack(
|
||||
propertyId_.name()+"Vector",
|
||||
std::move(propId));
|
||||
|
||||
newVarList.emplaceBack(
|
||||
shapeIndex().name()+"Vector",
|
||||
std::move(shapeIdx));
|
||||
|
||||
if(!dynPointStruct().insertPoints(position, newVarList))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pFlow::word pFlow::sphereParticles::shapeTypeName()const
|
||||
{
|
||||
|
@ -2,189 +2,195 @@
|
||||
O C enter of
|
||||
O O E ngineering and
|
||||
O O M ultiscale modeling of
|
||||
OOOOOOO F luid flow
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
-----------------------------------------------------------------------------*/
|
||||
/**
|
||||
/**
|
||||
* @class pFlow::sphereParticles
|
||||
*
|
||||
* @brief Class for managing spherical particles
|
||||
*
|
||||
*
|
||||
* @brief Class for managing spherical particles
|
||||
*
|
||||
* This is a top-level class that contains the essential components for
|
||||
* defining spherical prticles in a DEM simulation.
|
||||
*/
|
||||
|
||||
#ifndef __sphereParticles_hpp__
|
||||
#define __sphereParticles_hpp__
|
||||
#define __sphereParticles_hpp__
|
||||
|
||||
#include "systemControl.hpp"
|
||||
#include "particles.hpp"
|
||||
#include "sphereShape.hpp"
|
||||
#include "property.hpp"
|
||||
#include "indexContainer.hpp"
|
||||
|
||||
|
||||
#include "particles.hpp"
|
||||
#include "property.hpp"
|
||||
#include "sphereShape.hpp"
|
||||
#include "systemControl.hpp"
|
||||
|
||||
namespace pFlow
|
||||
{
|
||||
|
||||
class sphereParticles
|
||||
:
|
||||
public particles
|
||||
class sphereParticles : public particles
|
||||
{
|
||||
public:
|
||||
|
||||
using ShapeType = sphereShape;
|
||||
|
||||
private:
|
||||
|
||||
/// reference to shapes
|
||||
ShapeType spheres_;
|
||||
/// reference to shapes
|
||||
ShapeType spheres_;
|
||||
|
||||
/// property id on device
|
||||
uint32PointField_D propertyId_;
|
||||
uint32PointField_D propertyId_;
|
||||
|
||||
/// diameter / boundig sphere size of particles on device
|
||||
realPointField_D diameter_;
|
||||
realPointField_D diameter_;
|
||||
|
||||
/// mass of particles field
|
||||
realPointField_D mass_;
|
||||
/// mass of particles field
|
||||
realPointField_D mass_;
|
||||
|
||||
/// pointField of inertial of particles
|
||||
realPointField_D I_;
|
||||
/// pointField of inertial of particles
|
||||
realPointField_D I_;
|
||||
|
||||
/// pointField of rotational Velocity of particles on device
|
||||
realx3PointField_D rVelocity_;
|
||||
/// pointField of rotational Velocity of particles on device
|
||||
realx3PointField_D rVelocity_;
|
||||
|
||||
/// pointField of rotational acceleration of particles on device
|
||||
realx3PointField_D rAcceleration_;
|
||||
/// pointField of rotational acceleration of particles on device
|
||||
realx3PointField_D rAcceleration_;
|
||||
|
||||
/// rotational velocity integrator
|
||||
uniquePtr<integration> rVelIntegration_ = nullptr;
|
||||
/// rotational velocity integrator
|
||||
uniquePtr<integration> rVelIntegration_ = nullptr;
|
||||
|
||||
/// timer for acceleration computations
|
||||
Timer accelerationTimer_;
|
||||
/// timer for acceleration computations
|
||||
Timer accelerationTimer_;
|
||||
|
||||
/// timer for integration computations (prediction step)
|
||||
Timer intPredictTimer_;
|
||||
Timer intPredictTimer_;
|
||||
|
||||
/// timer for integration computations (correction step)
|
||||
Timer intCorrectTimer_;
|
||||
Timer intCorrectTimer_;
|
||||
|
||||
bool initInertia();
|
||||
|
||||
|
||||
private:
|
||||
bool initializeParticles();
|
||||
|
||||
bool getParticlesInfoFromShape(
|
||||
const wordVector& shapeNames,
|
||||
uint32Vector& propIds,
|
||||
realVector& diams,
|
||||
realVector& m,
|
||||
realVector& Is,
|
||||
uint32Vector& shIndex
|
||||
);
|
||||
/*bool initializeParticles();
|
||||
|
||||
bool insertSphereParticles(
|
||||
const wordVector& names,
|
||||
const int32IndexContainer& indices,
|
||||
bool setId = true);
|
||||
const wordVector& names,
|
||||
const int32IndexContainer& indices,
|
||||
bool setId = true);
|
||||
|
||||
virtual uniquePtr<List<eventObserver*>> getFieldObjectList()const override;
|
||||
*/
|
||||
|
||||
public:
|
||||
|
||||
/// construct from systemControl and property
|
||||
sphereParticles(
|
||||
systemControl &control,
|
||||
const property& prop);
|
||||
/// construct from systemControl and property
|
||||
sphereParticles(systemControl& control, const property& prop);
|
||||
|
||||
|
||||
~sphereParticles()override=default;
|
||||
~sphereParticles() override = default;
|
||||
|
||||
/**
|
||||
* Insert new particles in position with specified shapes
|
||||
*
|
||||
* This function is involked by inserted object to insert new set of particles
|
||||
* into the simulation.
|
||||
* \param position position of new particles
|
||||
*
|
||||
* This function is involked by inserted object to insert new set of
|
||||
* particles into the simulation. \param position position of new particles
|
||||
* \param shape shape of new particles
|
||||
* \param setField initial value of the selected fields for new particles
|
||||
*/
|
||||
/*bool insertParticles
|
||||
(
|
||||
const realx3Vector& position,
|
||||
const wordVector& shapes,
|
||||
const setFieldList& setField
|
||||
const realx3Vector& position,
|
||||
const wordVector& shapes,
|
||||
const setFieldList& setField
|
||||
) override ;*/
|
||||
|
||||
/// const reference to shapes object
|
||||
const auto& spheres()const
|
||||
/// const reference to shapes object
|
||||
const auto& spheres() const
|
||||
{
|
||||
return spheres_;
|
||||
}
|
||||
|
||||
/// const reference to inertia pointField
|
||||
const auto& I()const
|
||||
const auto& I() const
|
||||
{
|
||||
return I_;
|
||||
}
|
||||
|
||||
/// reference to inertia pointField
|
||||
/// reference to inertia pointField
|
||||
auto& I()
|
||||
{
|
||||
return I_;
|
||||
}
|
||||
|
||||
const auto& rVelocity()const
|
||||
{
|
||||
|
||||
const auto& rVelocity() const
|
||||
{
|
||||
return rVelocity_;
|
||||
}
|
||||
|
||||
auto& rVelocity()
|
||||
{
|
||||
{
|
||||
return rVelocity_;
|
||||
}
|
||||
|
||||
bool hearChanges
|
||||
(
|
||||
real t,
|
||||
real dt,
|
||||
uint32 iter,
|
||||
const message& msg,
|
||||
const anyList& varList
|
||||
bool hearChanges(
|
||||
real t,
|
||||
real dt,
|
||||
uint32 iter,
|
||||
const message& msg,
|
||||
const anyList& varList
|
||||
) override
|
||||
{
|
||||
notImplementedFunction;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const uint32PointField_D& propertyId()const override
|
||||
const uint32PointField_D& propertyId() const override
|
||||
{
|
||||
return propertyId_;
|
||||
}
|
||||
|
||||
|
||||
const realPointField_D& diameter()const override
|
||||
|
||||
const realPointField_D& diameter() const override
|
||||
{
|
||||
return diameter_;
|
||||
}
|
||||
|
||||
|
||||
const realPointField_D& mass()const override
|
||||
const realPointField_D& mass() const override
|
||||
{
|
||||
return mass_;
|
||||
}
|
||||
|
||||
/// before iteration step
|
||||
|
||||
/// before iteration step
|
||||
bool beforeIteration() override;
|
||||
|
||||
/// iterate particles
|
||||
bool iterate() override;
|
||||
/// iterate particles
|
||||
bool iterate() override;
|
||||
|
||||
bool insertParticles(
|
||||
const realx3Vector& position,
|
||||
const wordVector& shapesNames,
|
||||
const anyList& setVarList
|
||||
) override;
|
||||
|
||||
|
||||
realx3PointField_D& rAcceleration() override
|
||||
{
|
||||
return rAcceleration_;
|
||||
@ -194,20 +200,19 @@ public:
|
||||
{
|
||||
return rAcceleration_;
|
||||
}
|
||||
|
||||
const realPointField_D& boundingSphere()const override
|
||||
|
||||
const realPointField_D& boundingSphere() const override
|
||||
{
|
||||
return diameter();
|
||||
}
|
||||
|
||||
word shapeTypeName()const override;
|
||||
|
||||
const shape& getShapes()const override;
|
||||
word shapeTypeName() const override;
|
||||
|
||||
|
||||
void boundingSphereMinMax(real & minDiam, real& maxDiam)const override;
|
||||
|
||||
}; //sphereParticles
|
||||
const shape& getShapes() const override;
|
||||
|
||||
void boundingSphereMinMax(real& minDiam, real& maxDiam) const override;
|
||||
|
||||
}; // sphereParticles
|
||||
|
||||
} // pFlow
|
||||
|
||||
|
Reference in New Issue
Block a user