2022-12-03 08:42:56 +00:00
|
|
|
/*------------------------------- 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-09 22:02:54 +00:00
|
|
|
#include "sphereDEMSystem.hpp"
|
2022-12-03 08:42:56 +00:00
|
|
|
|
|
|
|
|
2022-12-30 14:03:56 +00:00
|
|
|
pFlow::sphereDEMSystem::sphereDEMSystem(
|
2022-12-24 11:30:00 +00:00
|
|
|
word demSystemName,
|
|
|
|
const std::vector<box>& domains,
|
|
|
|
int argc,
|
|
|
|
char* argv[])
|
2022-12-06 15:20:47 +00:00
|
|
|
:
|
2022-12-30 14:03:56 +00:00
|
|
|
DEMSystem(demSystemName, domains, argc, argv)
|
2022-12-03 08:42:56 +00:00
|
|
|
{
|
2022-12-06 15:20:47 +00:00
|
|
|
|
2022-12-24 11:30:00 +00:00
|
|
|
REPORT(0)<<"Initializing host/device execution spaces . . . \n";
|
|
|
|
REPORT(1)<<"Host execution space is "<< greenText(DefaultHostExecutionSpace::name())<<endREPORT;
|
|
|
|
REPORT(1)<<"Device execution space is "<<greenText(DefaultExecutionSpace::name())<<endREPORT;
|
2022-12-06 15:20:47 +00:00
|
|
|
|
|
|
|
// initialize Kokkos
|
|
|
|
Kokkos::initialize( argc, argv );
|
|
|
|
|
2022-12-24 11:30:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
REPORT(0)<<"\nReading proprties . . . "<<endREPORT;
|
2022-12-06 15:20:47 +00:00
|
|
|
property_ = makeUnique<property>(
|
|
|
|
Control().caseSetup().path()+propertyFile__);
|
|
|
|
|
2022-12-24 11:30:00 +00:00
|
|
|
REPORT(0)<< "\nCreating surface geometry for sphereDEMSystem . . . "<<endREPORT;
|
2022-12-06 15:20:47 +00:00
|
|
|
geometry_ = geometry::create(Control(), Property());
|
|
|
|
|
2022-12-24 11:30:00 +00:00
|
|
|
REPORT(0)<<"\nReading sphere particles . . ."<<endREPORT;
|
2022-12-06 15:20:47 +00:00
|
|
|
particles_ = makeUnique<sphereParticles>(Control(), Property());
|
|
|
|
|
|
|
|
|
2022-12-24 11:30:00 +00:00
|
|
|
REPORT(0)<<"\nCreating interaction model for sphere-sphere contact and sphere-wall contact . . ."<<endREPORT;
|
2022-12-06 15:20:47 +00:00
|
|
|
interaction_ = interaction::create(
|
|
|
|
Control(),
|
|
|
|
Particles(),
|
|
|
|
Geometry());
|
|
|
|
|
2022-12-24 11:30:00 +00:00
|
|
|
real minD, maxD;
|
|
|
|
particles_->boundingSphereMinMax(minD, maxD);
|
|
|
|
|
2022-12-30 14:03:56 +00:00
|
|
|
particleDistribution_ = makeUnique<domainDistribute>(domains, maxD);
|
2022-12-24 11:30:00 +00:00
|
|
|
|
2022-12-06 15:20:47 +00:00
|
|
|
}
|
|
|
|
|
2022-12-30 14:03:56 +00:00
|
|
|
pFlow::sphereDEMSystem::~sphereDEMSystem()
|
2022-12-06 15:20:47 +00:00
|
|
|
{
|
|
|
|
interaction_.reset();
|
|
|
|
insertion_.reset();
|
|
|
|
particles_.reset();
|
|
|
|
geometry_.reset();
|
|
|
|
property_.reset();
|
|
|
|
Control_.reset();
|
|
|
|
|
|
|
|
output<< "\nFinalizing host/device execution space ...."<<endl;
|
|
|
|
Kokkos::finalize();
|
|
|
|
}
|
2022-12-03 08:42:56 +00:00
|
|
|
|
2022-12-24 11:30:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
pFlow::int32
|
2022-12-30 14:03:56 +00:00
|
|
|
pFlow::sphereDEMSystem::numParInDomain(int32 di)const
|
2022-12-24 11:30:00 +00:00
|
|
|
{
|
|
|
|
return particleDistribution_().numParInDomain(di);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<pFlow::int32>
|
2022-12-30 14:03:56 +00:00
|
|
|
pFlow::sphereDEMSystem::numParInDomain()const
|
2022-12-24 11:30:00 +00:00
|
|
|
{
|
|
|
|
const auto& distribute = particleDistribution_();
|
|
|
|
int32 numDomains = distribute.numDomains();
|
|
|
|
std::vector<int32> nums(numDomains);
|
|
|
|
for(int32 i=0; i<numDomains; i++)
|
|
|
|
{
|
|
|
|
nums[i] = distribute.numParInDomain(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
return nums;
|
|
|
|
}
|
|
|
|
|
2022-12-30 14:03:56 +00:00
|
|
|
pFlow::span<const pFlow::int32>
|
|
|
|
pFlow::sphereDEMSystem::parIndexInDomain(int32 di)const
|
|
|
|
{
|
|
|
|
return particleDistribution_->particlesInDomain(di);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool pFlow::sphereDEMSystem::changeDomainsSizeUpdateParticles(
|
|
|
|
const std::vector<box>& domains)
|
|
|
|
{
|
|
|
|
if( !particleDistribution_->changeDomainsSize(domains))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// should update list of particles here
|
|
|
|
//************************************************************************************************
|
|
|
|
notImplementedFunction;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool pFlow::sphereDEMSystem::updateParticles()
|
|
|
|
{
|
|
|
|
notImplementedFunction;
|
|
|
|
return false;
|
|
|
|
}
|
2022-12-24 11:30:00 +00:00
|
|
|
|
2022-12-30 14:03:56 +00:00
|
|
|
bool pFlow::sphereDEMSystem::iterate(
|
2022-12-24 11:30:00 +00:00
|
|
|
int32 n,
|
|
|
|
real timeToWrite,
|
|
|
|
word timeName)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
pFlow::real
|
2022-12-30 14:03:56 +00:00
|
|
|
pFlow::sphereDEMSystem::maxBounndingSphereSize()const
|
2022-12-24 11:30:00 +00:00
|
|
|
{
|
|
|
|
real minD, maxD;
|
|
|
|
particles_->boundingSphereMinMax(minD, maxD);
|
|
|
|
|
|
|
|
return maxD;
|
|
|
|
}
|