src folder

This commit is contained in:
hamidrezanorouzi
2022-09-05 01:56:29 +04:30
parent 9d177aba28
commit ac5c3f08af
97 changed files with 11707 additions and 13 deletions

View File

@ -0,0 +1,47 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#ifndef __demParticles_H__
#define __demParticles_H__
#include "demComponent.H"
namespace pFlow
{
class demParticles
:
public demComponent
{
public:
demParticles(systemControl& control):
demComponent("particles", control)
{}
};
}
#endif

View File

@ -0,0 +1,81 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#ifndef __particleIdHandler_H__
#define __particleIdHandler_H__
#include "pointFields.H"
namespace pFlow
{
class particleIdHandler
{
protected:
int32 nextId_=0;
public:
particleIdHandler(int32PointField_HD & id)
{
int32 maxID = maxActive<DeviceSide>(id);
if( maxID != -1 && id.size() == 0 )
{
nextId_ = 0;
}
else if( maxID == -1 && id.size()>0 )
{
nextId_ = 0;
id.modifyOnHost();
forAll(i,id)
{
if(id.isActive(i))
{
id[i] = getNextId();
}
}
id.syncViews();
}
else if( maxID >= static_cast<int32>(id.size()) )
{
nextId_ = maxID + 1;
}
else
{
nextId_ = id.size();
}
}
int32 getNextId()
{
return nextId_++;
}
int32 nextId() const
{
return nextId_;
}
};
}
#endif

View File

@ -0,0 +1,162 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#include "particles.H"
pFlow::particles::particles
(
systemControl& control,
const word& integrationMethod
)
:
demParticles(control),
time_(control.time()),
integrationMethod_(integrationMethod),
dynPointStruct_(
control.time(),
integrationMethod
),
shapeName_(
control.time().emplaceObject<wordPointField>(
objectFile(
"shapeName",
"",
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS,
false
),
pStruct(),
word("NO_NAME_SHAPE")
)
),
id_(
control.time().emplaceObject<int32PointField_HD>(
objectFile(
"id",
"",
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
),
pStruct(),
static_cast<int32>(-1)
)
),
propertyId_(
control.time().emplaceObject<int8PointField_D>(
objectFile(
"propertyId",
"",
objectFile::READ_NEVER,
objectFile::WRITE_NEVER
),
pStruct(),
static_cast<int8>(0)
)
),
diameter_(
control.time().emplaceObject<realPointField_D>(
objectFile(
"diameter",
"",
objectFile::READ_NEVER,
objectFile::WRITE_ALWAYS
),
pStruct(),
static_cast<real>(0.00000000001)
)
),
mass_(
control.time().emplaceObject<realPointField_D>(
objectFile(
"mass",
"",
objectFile::READ_NEVER,
objectFile::WRITE_ALWAYS
),
pStruct(),
static_cast<real>(0.0000000001)
)
),
accelertion_(
control.time().emplaceObject<realx3PointField_D>(
objectFile(
"accelertion",
"",
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
),
pStruct(),
zero3
)
),
contactForce_(
control.time().emplaceObject<realx3PointField_D>(
objectFile(
"contactForce",
"",
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
),
pStruct(),
zero3
)
),
contactTorque_(
control.time().emplaceObject<realx3PointField_D>(
objectFile(
"contactTorque",
"",
objectFile::READ_IF_PRESENT,
objectFile::WRITE_ALWAYS
),
pStruct(),
zero3
)
),
idHandler_(id_)
{
this->subscribe(pStruct());
}
pFlow::uniquePtr<pFlow::List<pFlow::eventObserver*>>
pFlow::particles::getFieldObjectList()const
{
auto objListPtr = makeUnique<pFlow::List<pFlow::eventObserver*>>();
objListPtr().push_back(
static_cast<eventObserver*>(&id_) );
objListPtr().push_back(
static_cast<eventObserver*>(&propertyId_) );
objListPtr().push_back(
static_cast<eventObserver*>(&diameter_) );
objListPtr().push_back(
static_cast<eventObserver*>(&mass_) );
objListPtr().push_back(
static_cast<eventObserver*>(&shapeName_) );
return objListPtr;
}

View File

@ -0,0 +1,291 @@
/*------------------------------- 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.
-----------------------------------------------------------------------------*/
#ifndef __particles_H__
#define __particles_H__
#include "dynamicPointStructure.H"
#include "particleIdHandler.H"
#include "demParticles.H"
namespace pFlow
{
class setFieldList;
class particles
:
public eventObserver,
public demParticles
{
protected:
// owner repository
Time& time_;
const word integrationMethod_;
// dynamic point structure for particles
dynamicPointStructure dynPointStruct_;
// - name of shapes - this is managed by particles
wordPointField& shapeName_;
// id of particles on host
int32PointField_HD& id_;
// property id on device
int8PointField_D& propertyId_;
// diameter / boundig sphere size of particles on device
realPointField_D& diameter_;
// mass on device
realPointField_D& mass_;
// - acceleration on device
realx3PointField_D& accelertion_;
realx3PointField_D& contactForce_;
realx3PointField_D& contactTorque_;
// - object handling particle id
particleIdHandler idHandler_;
virtual uniquePtr<List<eventObserver*>> getFieldObjectList()const;
void zeroForce()
{
contactForce_.fill(zero3);
}
void zeroTorque()
{
contactTorque_.fill(zero3);
}
public:
// type info
TypeName("particles");
particles(systemControl& control, const word& integrationMethod);
inline const auto& time()const {
return time_;
}
inline auto& time() {
return time_;
}
inline auto integrationMethod()const
{
return integrationMethod_;
}
inline const auto& dynPointStruct()const
{
return dynPointStruct_;
}
inline auto& dynPointStruct()
{
return dynPointStruct_;
}
inline const auto& pStruct()const{
return dynPointStruct_.pStruct();
}
inline auto& pStruct(){
return dynPointStruct_.pStruct();
}
inline auto size()const{
return pStruct().size();
}
inline auto capacity() const{
return pStruct().capacity();
}
inline auto activePointsMaskD()const{
return pStruct().activePointsMaskD();
}
inline auto numActive()const
{
return pStruct().numActive();
}
inline bool allActive()const{
return pStruct().allActive();
}
inline auto activeRange()const{
return pStruct().activeRange();
}
inline auto activePointsMaskH()const{
return pStruct().activePointsMaskH();
}
inline const auto& pointPosition()const{
return pStruct().pointPosition();
}
inline const auto& position()const
{
return pStruct().pointPosition();
}
inline const auto& pointVelocity()const{
return dynPointStruct().velocity();
}
inline const auto& velocity()const{
return dynPointStruct().velocity();
}
inline const auto& id()const{
return id_;
}
inline auto& id(){
return id_;
}
inline const auto& diameter()const{
return diameter_;
}
inline auto& diameter(){
return diameter_;
}
inline const auto& mass()const{
return mass_;
}
inline auto& mass() {
return mass_;
}
inline const auto& accelertion()const{
return accelertion_;
}
inline auto& accelertion(){
return accelertion_;
}
inline
realx3PointField_D& contactForce()
{
return contactForce_;
}
inline
const realx3PointField_D& contactForce() const
{
return contactForce_;
}
inline
realx3PointField_D& contactTorque()
{
return contactTorque_;
}
inline
const realx3PointField_D& contactTorque() const
{
return contactTorque_;
}
inline const auto& propertyId()const{
return propertyId_;
}
inline auto& propertyId(){
return propertyId_;
}
inline const auto& shapeName()const{
return shapeName_;
}
inline auto& shapName(){
return shapeName_;
}
bool beforeIteration() override
{
auto domain = this->control().domain();
auto numMarked = dynPointStruct_.markDeleteOutOfBox(domain);
/*if(numMarked)
{
output<<"\nNumber of deleted points/particles that are out of domain box: "<<numMarked<<endl;
}*/
this->zeroForce();
this->zeroTorque();
return true;
}
virtual
bool insertParticles
(
const realx3Vector& position,
const wordVector& shapes,
const setFieldList& setField
) = 0;
virtual
realx3PointField_D& rAcceleration() = 0;
virtual
const realx3PointField_D& rAcceleration() const = 0;
virtual
const realVector_D& boundingSphere()const = 0;
virtual
word shapeTypeName()const = 0;
virtual
void boundingSphereMinMax(real & minDiam, real& maxDiam)const = 0;
}; // particles
} // pFlow
#endif //__particles_H__