Files
phasicFlow/src/Particles/particles/particles.hpp

245 lines
4.2 KiB
C++
Raw Normal View History

2022-09-05 01:56:29 +04:30
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
2022-12-10 01:32:54 +03:30
#ifndef __particles_hpp__
#define __particles_hpp__
2022-09-05 01:56:29 +04:30
2022-12-10 01:32:54 +03:30
#include "dynamicPointStructure.hpp"
2024-01-21 13:26:23 -08:00
#include "demComponent.hpp"
#include "shape.hpp"
#include "particleIdHandler.hpp"
2024-01-21 13:26:23 -08:00
2022-09-05 01:56:29 +04:30
namespace pFlow
{
class particles
:
2024-01-21 13:26:23 -08:00
public observer,
public demComponent
2022-09-05 01:56:29 +04:30
{
2024-01-21 13:26:23 -08:00
private:
2022-09-05 01:56:29 +04:30
2024-01-21 13:26:23 -08:00
/// dynamic point structure for particles center mass
2022-09-05 01:56:29 +04:30
dynamicPointStructure dynPointStruct_;
/// id of particles on host
uint32PointField_D id_;
2022-09-05 01:56:29 +04:30
2024-01-26 01:10:10 -08:00
uint32PointField_D shapeIndex_;
2022-09-05 01:56:29 +04:30
/// acceleration on device
realx3PointField_D accelertion_;
2022-09-05 01:56:29 +04:30
2024-01-21 13:26:23 -08:00
/// contact force field
realx3PointField_D contactForce_;
2022-09-05 01:56:29 +04:30
2024-01-21 13:26:23 -08:00
/// contact torque field
realx3PointField_D contactTorque_;
2022-09-05 01:56:29 +04:30
uniquePtr<particleIdHandler> idHandler_ = nullptr;
static inline
const message defaultMessage_{message::DEFAULT};
2022-09-05 01:56:29 +04:30
2024-01-26 01:10:10 -08:00
2022-09-05 01:56:29 +04:30
void zeroForce()
{
contactForce_.fill(zero3);
2022-09-05 01:56:29 +04:30
}
void zeroTorque()
{
contactTorque_.fill(zero3);
2022-09-05 01:56:29 +04:30
}
2024-01-21 13:26:23 -08:00
protected:
2022-09-05 01:56:29 +04:30
2024-01-21 13:26:23 -08:00
inline auto& dynPointStruct()
2022-09-05 01:56:29 +04:30
{
2024-01-21 13:26:23 -08:00
return dynPointStruct_;
2022-09-05 01:56:29 +04:30
}
2024-01-21 13:26:23 -08:00
inline auto& pointPosition()
2022-09-05 01:56:29 +04:30
{
2024-01-21 13:26:23 -08:00
return dynPointStruct_.pointPosition();
2022-09-05 01:56:29 +04:30
}
/*inline
2024-01-21 13:26:23 -08:00
auto& velocity()
2022-09-05 01:56:29 +04:30
{
2024-01-21 13:26:23 -08:00
return dynPointStruct_.velocity();
}*/
2022-09-05 01:56:29 +04:30
inline
auto& shapeIndex()
{
return shapeIndex_;
}
2024-01-21 13:26:23 -08:00
public:
2022-09-05 01:56:29 +04:30
2024-01-21 13:26:23 -08:00
// type info
TypeInfo("particles");
explicit particles(systemControl& control);
inline
const auto& dynPointStruct()const
{
return dynPointStruct_;
}
inline
const pointStructure& pStruct()const
2024-01-21 13:26:23 -08:00
{
return dynPointStruct_;
}
inline
const auto& simDomain()const
{
return dynPointStruct_.simDomain();
}
inline
const auto& thisDomain()const
{
return dynPointStruct_.thisDomain();
}
2022-09-05 01:56:29 +04:30
inline auto size()const{
2024-01-21 13:26:23 -08:00
return dynPointStruct_.size();
2022-09-05 01:56:29 +04:30
}
inline auto capacity() const{
2024-01-21 13:26:23 -08:00
return dynPointStruct_.capacity();
2022-09-05 01:56:29 +04:30
}
2024-01-21 13:26:23 -08:00
2022-09-05 01:56:29 +04:30
inline auto numActive()const
{
2024-01-21 13:26:23 -08:00
return dynPointStruct_.numActive();
2022-09-05 01:56:29 +04:30
}
2024-01-21 13:26:23 -08:00
inline bool isAllActive()const
2022-09-05 01:56:29 +04:30
{
2024-01-21 13:26:23 -08:00
return dynPointStruct_.isAllActive();
2022-09-05 01:56:29 +04:30
}
2024-01-21 13:26:23 -08:00
inline
const auto& pointPosition()const
{
return dynPointStruct_.pointPosition();
2022-09-05 01:56:29 +04:30
}
2024-01-21 13:26:23 -08:00
inline
const auto& velocity()const
{
return dynPointStruct_.velocity();
2022-09-05 01:56:29 +04:30
}
2024-01-21 13:26:23 -08:00
inline
const auto& accelertion()const
{
2022-09-05 01:56:29 +04:30
return accelertion_;
}
2024-01-21 13:26:23 -08:00
inline
auto& accelertion()
{
2022-09-05 01:56:29 +04:30
return accelertion_;
}
inline
2024-01-21 13:26:23 -08:00
auto& contactForce()
2022-09-05 01:56:29 +04:30
{
return contactForce_;
}
inline
2024-01-21 13:26:23 -08:00
const auto& contactForce() const
2022-09-05 01:56:29 +04:30
{
return contactForce_;
}
inline
2024-01-21 13:26:23 -08:00
auto& contactTorque()
2022-09-05 01:56:29 +04:30
{
return contactTorque_;
}
inline
2024-01-21 13:26:23 -08:00
const auto& contactTorque() const
2022-09-05 01:56:29 +04:30
{
return contactTorque_;
}
bool beforeIteration() override;
2022-09-05 01:56:29 +04:30
bool iterate()override;
2022-09-05 01:56:29 +04:30
bool afterIteration() override;
2022-09-05 01:56:29 +04:30
2024-01-21 13:26:23 -08:00
/*virtual
2022-09-05 01:56:29 +04:30
bool insertParticles
(
const realx3Vector& position,
const wordVector& shapes,
const setFieldList& setField
2024-01-21 13:26:23 -08:00
) = 0;*/
2022-09-05 01:56:29 +04:30
2024-01-26 01:10:10 -08:00
virtual
const uint32PointField_D& propertyId()const = 0;
2022-09-05 01:56:29 +04:30
2024-01-26 01:10:10 -08:00
virtual
const realPointField_D& diameter()const = 0;
virtual
const realPointField_D& mass()const = 0;
2022-09-05 01:56:29 +04:30
virtual
realx3PointField_D& rAcceleration() = 0;
virtual
const realx3PointField_D& rAcceleration() const = 0;
virtual
const realPointField_D& boundingSphere()const = 0;
2022-09-05 01:56:29 +04:30
virtual
word shapeTypeName()const = 0;
virtual
const shape& getShapes()const = 0;
virtual
2024-01-26 01:10:10 -08:00
void boundingSphereMinMax(real & minDiam, real& maxDiam)const = 0;
2022-09-05 01:56:29 +04:30
}; // particles
} // pFlow
2022-12-10 01:32:54 +03:30
#endif //__particles_hpp__