Merge pull request #58 from PhasicFlow/coupling

DEMsystems initialize finalize
This commit is contained in:
PhasicFlow 2022-12-06 18:51:57 +03:30 committed by GitHub
commit f2dd0b2342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 92 additions and 8 deletions

View File

@ -3,7 +3,7 @@ set(SourceFiles
sphereDEMSystem/sphereDEMSystem.C
)
set(link_libs Kokkos::kokkos phasicFlow Particles Geometry Property Interaction Interaction)
set(link_libs Kokkos::kokkos phasicFlow Particles Geometry Property Interaction Interaction Utilities)
pFlow_add_library_install(DEMSystems SourceFiles link_libs)

View File

@ -21,7 +21,67 @@ Licence:
#include "sphereDEMSystem.H"
pFlow::sphereDEMSystem::sphereDEMSystem()
pFlow::sphereDEMSystem::sphereDEMSystem(int argc, char* argv[])
:
ControlDict_()
{
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;
property_ = makeUnique<property>(
Control().caseSetup().path()+propertyFile__);
Report(0)<< "\nCreating surface geometry for sphereDEMSystem . . . "<<endReport;
geometry_ = geometry::create(Control(), Property());
Report(0)<<"\nReading sphere particles . . ."<<endReport;
particles_ = makeUnique<sphereParticles>(Control(), Property());
//Report(0)<<"\nCreating particle insertion for spheres. . ."<<endReport;
/*insertion_ =
Control().caseSetup().emplaceObject<sphereInsertion>(
objectFile(
insertionFile__,
"",
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS
),
sphParticles,
sphParticles.shapes()
);*/
Report(0)<<"\nCreating interaction model for sphere-sphere contact and sphere-wall contact . . ."<<endReport;
interaction_ = interaction::create(
Control(),
Particles(),
Geometry());
}
pFlow::sphereDEMSystem::~sphereDEMSystem()
{
interaction_.reset();
insertion_.reset();
particles_.reset();
geometry_.reset();
property_.reset();
Control_.reset();
output<< "\nFinalizing host/device execution space ...."<<endl;
Kokkos::finalize();
}

View File

@ -21,6 +21,8 @@ Licence:
#ifndef __sphereDEMSystem_H__
#define __sphereDEMSystem_H__
#include <array>
#include "systemControl.H"
#include "property.H"
#include "uniquePtr.H"
@ -28,6 +30,9 @@ Licence:
#include "sphereParticles.H"
#include "interaction.H"
#include "Insertions.H"
#include "readControlDict.H"
namespace pFlow
@ -37,7 +42,9 @@ class sphereDEMSystem
{
protected:
systemControl Control_;
readControlDict ControlDict_;
uniquePtr<systemControl> Control_ = nullptr;
uniquePtr<property> property_ = nullptr;
@ -45,13 +52,15 @@ protected:
uniquePtr<sphereParticles> particles_ = nullptr;
uniquePtr<sphereInsertion> insertion_ = nullptr;
uniquePtr<interaction> interaction_ = nullptr;
uniquePtr<sphereInsertion> insertion_ = nullptr;
auto& Control()
{
return Control_;
return Control_();
}
auto& Property()
@ -76,7 +85,22 @@ protected:
public:
sphereDEMSystem();
sphereDEMSystem(int argc, char* argv[]);
~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()};
}
};

View File

@ -38,7 +38,7 @@ auto& sphInsertion =
Report(0)<<"\nCreating interation model for sphere-sphere contact and sphere-wall contact . . ."<<endReport;
Report(0)<<"\nCreating interaction model for sphere-sphere contact and sphere-wall contact . . ."<<endReport;
auto interactionPtr = interaction::create(
Control,
sphParticles,