2022-09-05 01:56:29 +04:30
|
|
|
/*------------------------------- phasicFlow ---------------------------------
|
|
|
|
O C enter of
|
|
|
|
O O E ngineering and
|
|
|
|
O O M ultiscale modeling of
|
2024-04-12 22:39:09 -07:00
|
|
|
OOOOOOO F luid flow
|
2022-09-05 01:56:29 +04:30
|
|
|
------------------------------------------------------------------------------
|
|
|
|
Copyright (C): www.cemf.ir
|
|
|
|
email: hamid.r.norouzi AT gmail.com
|
2024-04-12 22:39:09 -07:00
|
|
|
------------------------------------------------------------------------------
|
2022-09-05 01:56:29 +04:30
|
|
|
Licence:
|
2024-04-12 22:39:09 -07:00
|
|
|
This file is part of phasicFlow code. It is a free software for simulating
|
2022-09-05 01:56:29 +04:30
|
|
|
granular and multiphase flows. You can redistribute it and/or modify it under
|
2024-04-12 22:39:09 -07:00
|
|
|
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
|
2022-09-05 01:56:29 +04:30
|
|
|
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
|
|
|
#include "particles.hpp"
|
2022-09-05 01:56:29 +04:30
|
|
|
|
2024-04-12 22:39:09 -07:00
|
|
|
pFlow::particles::particles(systemControl& control)
|
|
|
|
: observer(defaultMessage_),
|
|
|
|
demComponent("particles", control),
|
|
|
|
dynPointStruct_(control),
|
|
|
|
/*id_(
|
|
|
|
objectFile(
|
|
|
|
"id",
|
|
|
|
"",
|
|
|
|
objectFile::READ_IF_PRESENT,
|
|
|
|
objectFile::WRITE_ALWAYS
|
|
|
|
),
|
|
|
|
dynPointStruct_,
|
|
|
|
static_cast<uint32>(-1),
|
|
|
|
static_cast<uint32>(-1)
|
|
|
|
),*/
|
|
|
|
shapeIndex_(
|
|
|
|
objectFile(
|
|
|
|
"shapeIndex",
|
|
|
|
"",
|
|
|
|
objectFile::READ_ALWAYS,
|
|
|
|
objectFile::WRITE_ALWAYS
|
|
|
|
),
|
|
|
|
dynPointStruct_,
|
|
|
|
0
|
|
|
|
),
|
|
|
|
accelertion_(
|
|
|
|
objectFile(
|
|
|
|
"accelertion",
|
|
|
|
"",
|
|
|
|
objectFile::READ_IF_PRESENT,
|
|
|
|
objectFile::WRITE_ALWAYS
|
|
|
|
),
|
|
|
|
dynPointStruct_,
|
|
|
|
zero3
|
|
|
|
),
|
|
|
|
contactForce_(
|
|
|
|
objectFile(
|
|
|
|
"contactForce",
|
|
|
|
"",
|
|
|
|
objectFile::READ_IF_PRESENT,
|
|
|
|
objectFile::WRITE_ALWAYS
|
|
|
|
),
|
|
|
|
dynPointStruct_,
|
|
|
|
zero3
|
|
|
|
),
|
|
|
|
contactTorque_(
|
|
|
|
objectFile(
|
|
|
|
"contactTorque",
|
|
|
|
"",
|
|
|
|
objectFile::READ_IF_PRESENT,
|
|
|
|
objectFile::WRITE_ALWAYS
|
|
|
|
),
|
|
|
|
dynPointStruct_,
|
|
|
|
zero3
|
|
|
|
),
|
2024-05-12 19:10:04 +03:30
|
|
|
idHandler_(particleIdHandler::create(dynPointStruct_)),
|
|
|
|
baseFieldBoundaryUpdateTimer_("baseFieldBoundaryUpdate",&timers())
|
2022-09-05 01:56:29 +04:30
|
|
|
{
|
2024-01-25 03:07:59 -08:00
|
|
|
this->addToSubscriber(dynPointStruct_);
|
2024-03-22 08:26:14 -07:00
|
|
|
|
2024-04-27 09:03:19 -07:00
|
|
|
//idHandler_().initialIdCheck();
|
2022-09-05 01:56:29 +04:30
|
|
|
}
|
|
|
|
|
2024-04-12 22:39:09 -07:00
|
|
|
bool
|
|
|
|
pFlow::particles::beforeIteration()
|
2023-04-09 08:06:35 -07:00
|
|
|
{
|
2024-04-27 09:03:19 -07:00
|
|
|
if( !dynPointStruct_.beforeIteration())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-05-12 19:10:04 +03:30
|
|
|
zeroForce();
|
|
|
|
zeroTorque();
|
|
|
|
baseFieldBoundaryUpdateTimer_.start();
|
2024-04-27 09:03:19 -07:00
|
|
|
shapeIndex_.updateBoundariesSlaveToMasterIfRequested();
|
|
|
|
accelertion_.updateBoundariesSlaveToMasterIfRequested();
|
|
|
|
idHandler_().updateBoundariesSlaveToMasterIfRequested();
|
2024-05-12 19:10:04 +03:30
|
|
|
baseFieldBoundaryUpdateTimer_.end();
|
2024-04-27 09:03:19 -07:00
|
|
|
return true;
|
2023-04-09 08:06:35 -07:00
|
|
|
}
|
|
|
|
|
2024-04-12 22:39:09 -07:00
|
|
|
bool
|
|
|
|
pFlow::particles::iterate()
|
2022-09-05 01:56:29 +04:30
|
|
|
{
|
2024-01-25 03:07:59 -08:00
|
|
|
return dynPointStruct_.iterate();
|
|
|
|
}
|
|
|
|
|
2024-04-12 22:39:09 -07:00
|
|
|
bool
|
|
|
|
pFlow::particles::afterIteration()
|
2024-01-25 03:07:59 -08:00
|
|
|
{
|
|
|
|
return dynPointStruct_.afterIteration();
|
|
|
|
}
|
|
|
|
|
2024-04-12 22:39:09 -07:00
|
|
|
void
|
|
|
|
pFlow::particles::boundingSphereMinMax(real& minDiam, real& maxDiam) const
|
2024-01-25 03:07:59 -08:00
|
|
|
{
|
|
|
|
auto& shp = getShapes();
|
2024-04-12 22:39:09 -07:00
|
|
|
|
2024-01-25 03:07:59 -08:00
|
|
|
minDiam = shp.minBoundingSphere();
|
|
|
|
maxDiam = shp.maxBoundingSphere();
|
2024-04-12 22:39:09 -07:00
|
|
|
}
|