mirror of
https://github.com/PhasicFlow/phasicFlow.git
synced 2025-06-12 16:26:23 +00:00
correction in the macros to be compatible with OpenFOAM
This commit is contained in:
@ -21,37 +21,37 @@ Licence:
|
||||
#include "sphereDEMSystem.hpp"
|
||||
|
||||
|
||||
pFlow::sphereDEMSystem::sphereDEMSystem(int argc, char* argv[])
|
||||
pFlow::coupling::sphereDEMSystem::sphereDEMSystem(
|
||||
word demSystemName,
|
||||
int32 numDomains,
|
||||
const std::vector<box>& domains,
|
||||
int argc,
|
||||
char* argv[])
|
||||
:
|
||||
ControlDict_()
|
||||
DEMSystem(demSystemName, numDomains, domains, argc, argv)
|
||||
{
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
// initialize Kokkos
|
||||
Kokkos::initialize( argc, argv );
|
||||
|
||||
Report(0)<<"\nCreating Control repository . . ."<<endReport;
|
||||
Control_ = makeUnique<systemControl>(
|
||||
ControlDict_.startTime(),
|
||||
ControlDict_.endTime(),
|
||||
ControlDict_.saveInterval(),
|
||||
ControlDict_.startTimeName());
|
||||
|
||||
|
||||
Report(0)<<"\nReading proprties . . . "<<endReport;
|
||||
REPORT(0)<<"\nReading proprties . . . "<<endREPORT;
|
||||
property_ = makeUnique<property>(
|
||||
Control().caseSetup().path()+propertyFile__);
|
||||
|
||||
Report(0)<< "\nCreating surface geometry for sphereDEMSystem . . . "<<endReport;
|
||||
REPORT(0)<< "\nCreating surface geometry for sphereDEMSystem . . . "<<endREPORT;
|
||||
geometry_ = geometry::create(Control(), Property());
|
||||
|
||||
Report(0)<<"\nReading sphere particles . . ."<<endReport;
|
||||
REPORT(0)<<"\nReading sphere particles . . ."<<endREPORT;
|
||||
particles_ = makeUnique<sphereParticles>(Control(), Property());
|
||||
|
||||
|
||||
//Report(0)<<"\nCreating particle insertion for spheres. . ."<<endReport;
|
||||
//REPORT(0)<<"\nCreating particle insertion for spheres. . ."<<endREPORT;
|
||||
/*insertion_ =
|
||||
Control().caseSetup().emplaceObject<sphereInsertion>(
|
||||
objectFile(
|
||||
@ -64,15 +64,20 @@ pFlow::sphereDEMSystem::sphereDEMSystem(int argc, char* argv[])
|
||||
sphParticles.shapes()
|
||||
);*/
|
||||
|
||||
Report(0)<<"\nCreating interaction model for sphere-sphere contact and sphere-wall contact . . ."<<endReport;
|
||||
REPORT(0)<<"\nCreating interaction model for sphere-sphere contact and sphere-wall contact . . ."<<endREPORT;
|
||||
interaction_ = interaction::create(
|
||||
Control(),
|
||||
Particles(),
|
||||
Geometry());
|
||||
|
||||
real minD, maxD;
|
||||
particles_->boundingSphereMinMax(minD, maxD);
|
||||
|
||||
particleDistribution_ = makeUnique<domainDistribute>(numDomains, domains, maxD);
|
||||
|
||||
}
|
||||
|
||||
pFlow::sphereDEMSystem::~sphereDEMSystem()
|
||||
pFlow::coupling::sphereDEMSystem::~sphereDEMSystem()
|
||||
{
|
||||
interaction_.reset();
|
||||
insertion_.reset();
|
||||
@ -85,3 +90,42 @@ pFlow::sphereDEMSystem::~sphereDEMSystem()
|
||||
Kokkos::finalize();
|
||||
}
|
||||
|
||||
|
||||
|
||||
pFlow::int32
|
||||
pFlow::coupling::sphereDEMSystem::numParInDomain(int32 di)const
|
||||
{
|
||||
return particleDistribution_().numParInDomain(di);
|
||||
}
|
||||
|
||||
std::vector<pFlow::int32>
|
||||
pFlow::coupling::sphereDEMSystem::numParInDomain()const
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
bool pFlow::coupling::sphereDEMSystem::iterate(
|
||||
int32 n,
|
||||
real timeToWrite,
|
||||
word timeName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
pFlow::real
|
||||
pFlow::coupling::sphereDEMSystem::maxBounndingSphereSize()const
|
||||
{
|
||||
real minD, maxD;
|
||||
particles_->boundingSphereMinMax(minD, maxD);
|
||||
|
||||
return maxD;
|
||||
}
|
@ -21,54 +21,40 @@ Licence:
|
||||
#ifndef __sphereDEMSystem_hpp__
|
||||
#define __sphereDEMSystem_hpp__
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "systemControl.hpp"
|
||||
#include "DEMSystem.hpp"
|
||||
#include "property.hpp"
|
||||
#include "uniquePtr.hpp"
|
||||
#include "geometry.hpp"
|
||||
#include "sphereParticles.hpp"
|
||||
#include "interaction.hpp"
|
||||
#include "Insertions.hpp"
|
||||
#include "readControlDict.hpp"
|
||||
#include "domainDistribute.hpp"
|
||||
|
||||
|
||||
|
||||
|
||||
namespace pFlow
|
||||
namespace pFlow::coupling
|
||||
{
|
||||
|
||||
class sphereDEMSystem
|
||||
:
|
||||
public DEMSystem
|
||||
{
|
||||
protected:
|
||||
|
||||
readControlDict ControlDict_;
|
||||
// protected members
|
||||
|
||||
uniquePtr<systemControl> Control_ = nullptr;
|
||||
uniquePtr<property> property_ = nullptr;
|
||||
|
||||
uniquePtr<property> property_ = nullptr;
|
||||
|
||||
uniquePtr<geometry> geometry_ = nullptr;
|
||||
uniquePtr<geometry> geometry_ = nullptr;
|
||||
|
||||
uniquePtr<sphereParticles> particles_ = nullptr;
|
||||
|
||||
uniquePtr<sphereInsertion> insertion_ = nullptr;
|
||||
|
||||
uniquePtr<interaction> interaction_ = nullptr;
|
||||
uniquePtr<interaction> interaction_ = nullptr;
|
||||
|
||||
uniquePtr<domainDistribute> particleDistribution_=nullptr;
|
||||
|
||||
int32 numDomains_;
|
||||
|
||||
VectorDual<box> domains_;
|
||||
|
||||
Vector<int32Vector_H> parIndexInDomain_;
|
||||
|
||||
|
||||
auto& Control()
|
||||
{
|
||||
return Control_();
|
||||
}
|
||||
|
||||
// protected member functions
|
||||
auto& Property()
|
||||
{
|
||||
return property_();
|
||||
@ -91,27 +77,39 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
sphereDEMSystem(int argc, char* argv[]);
|
||||
TypeInfo("sphereDEMSystem");
|
||||
|
||||
~sphereDEMSystem();
|
||||
sphereDEMSystem(
|
||||
word demSystemName,
|
||||
int32 numDomains,
|
||||
const std::vector<box>& domains,
|
||||
int argc,
|
||||
char* argv[]);
|
||||
|
||||
virtual ~sphereDEMSystem();
|
||||
|
||||
sphereDEMSystem(const sphereDEMSystem&)=delete;
|
||||
|
||||
sphereDEMSystem& operator = (const sphereDEMSystem&)=delete;
|
||||
|
||||
|
||||
std::array<double,3> g()const
|
||||
{
|
||||
return {
|
||||
Control_->g().x(),
|
||||
Control_->g().y(),
|
||||
Control_->g().z()};
|
||||
}
|
||||
add_vCtor(
|
||||
DEMSystem,
|
||||
sphereDEMSystem,
|
||||
word);
|
||||
|
||||
bool inline usingDoulle()const
|
||||
{
|
||||
return pFlow::usingDouble__;
|
||||
}
|
||||
|
||||
|
||||
int32 numParInDomain(int32 di)const override;
|
||||
|
||||
|
||||
std::vector<int32> numParInDomain()const override;
|
||||
|
||||
|
||||
virtual
|
||||
bool iterate(int32 n, real timeToWrite, word timeName) override;
|
||||
|
||||
virtual
|
||||
real maxBounndingSphereSize()const override;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user