From 63bd9c9993df1df0d66a5e7ad6fb3f9166ec38e7 Mon Sep 17 00:00:00 2001 From: HRN Date: Mon, 3 Feb 2025 23:49:11 +0330 Subject: [PATCH] the need to provide neighborLength in domain dictionary is lifted. Now it is optional --- DEMSystems/grainDEMSystem/grainDEMSystem.cpp | 7 ++++++- DEMSystems/grainDEMSystem/grainDEMSystem.hpp | 2 ++ .../grainDEMSystem/grainFluidParticles.cpp | 4 ++-- .../grainDEMSystem/grainFluidParticles.hpp | 2 +- .../sphereDEMSystem/sphereDEMSystem.cpp | 8 +++++++- .../sphereDEMSystem/sphereDEMSystem.hpp | 2 ++ .../sphereDEMSystem/sphereFluidParticles.cpp | 4 ++-- .../sphereDEMSystem/sphereFluidParticles.hpp | 2 +- solvers/grainGranFlow/createDEMComponents.hpp | 9 ++++++++- .../createDEMComponents.hpp | 10 +++++++++- .../sphereGranFlow/createDEMComponents.hpp | 12 +++++++++-- .../grainParticles/grainParticles.cpp | 11 +++------- .../grainParticles/grainParticles.hpp | 4 ++-- .../insertionRegion/insertionRegion.cpp | 1 + .../sphereParticles/sphereParticles.cpp | 11 +++------- .../sphereParticles/sphereParticles.hpp | 4 ++-- .../dynamicPointStructure.cpp | 5 +++-- .../dynamicPointStructure.hpp | 2 +- src/Particles/particles/particles.cpp | 16 +++------------ src/Particles/particles/particles.hpp | 7 +++++-- src/Particles/particles/shape/shape.hpp | 2 +- .../domain/regularSimulationDomain.cpp | 5 +++-- .../domain/regularSimulationDomain.hpp | 2 +- .../domain/simulationDomain.cpp | 20 ++++++++++--------- .../domain/simulationDomain.hpp | 9 +++++---- .../pointStructure/pointStructure.cpp | 8 +++++--- .../pointStructure/pointStructure.hpp | 3 ++- utilities/pFlowToVTK/pointFieldToVTK.cpp | 4 ++-- .../particlesPhasicFlow.cpp | 4 ++-- .../postprocessPhasicFlow/postprocess.cpp | 2 +- 30 files changed, 106 insertions(+), 76 deletions(-) diff --git a/DEMSystems/grainDEMSystem/grainDEMSystem.cpp b/DEMSystems/grainDEMSystem/grainDEMSystem.cpp index 0673012f..1f04ece8 100644 --- a/DEMSystems/grainDEMSystem/grainDEMSystem.cpp +++ b/DEMSystems/grainDEMSystem/grainDEMSystem.cpp @@ -78,9 +78,14 @@ pFlow::grainDEMSystem::grainDEMSystem( REPORT(0)<< "\nCreating surface geometry for grainDEMSystem . . . "<( + pFlow::shapeFile__, + &Control().caseSetup(), + Property() ); REPORT(0)<<"\nReading grain particles . . ."<(Control(), Property()); + particles_ = makeUnique(Control(), grains_()); insertion_ = makeUnique( diff --git a/DEMSystems/grainDEMSystem/grainDEMSystem.hpp b/DEMSystems/grainDEMSystem/grainDEMSystem.hpp index 07451942..af849941 100644 --- a/DEMSystems/grainDEMSystem/grainDEMSystem.hpp +++ b/DEMSystems/grainDEMSystem/grainDEMSystem.hpp @@ -46,6 +46,8 @@ protected: uniquePtr geometry_ = nullptr; + uniquePtr grains_ = nullptr; + uniquePtr particles_ = nullptr; uniquePtr insertion_ = nullptr; diff --git a/DEMSystems/grainDEMSystem/grainFluidParticles.cpp b/DEMSystems/grainDEMSystem/grainFluidParticles.cpp index e58ab65b..2ead2ec3 100644 --- a/DEMSystems/grainDEMSystem/grainFluidParticles.cpp +++ b/DEMSystems/grainDEMSystem/grainFluidParticles.cpp @@ -35,8 +35,8 @@ void pFlow::grainFluidParticles::checkHostMemory() pFlow::grainFluidParticles::grainFluidParticles( systemControl &control, - const property &prop) - : grainParticles(control, prop), + const grainShape& grains) + : grainParticles(control, grains), fluidForce_( objectFile( "fluidForce", diff --git a/DEMSystems/grainDEMSystem/grainFluidParticles.hpp b/DEMSystems/grainDEMSystem/grainFluidParticles.hpp index ba547556..04d4642d 100644 --- a/DEMSystems/grainDEMSystem/grainFluidParticles.hpp +++ b/DEMSystems/grainDEMSystem/grainFluidParticles.hpp @@ -59,7 +59,7 @@ protected: public: /// construct from systemControl and property - grainFluidParticles(systemControl &control, const property& prop); + grainFluidParticles(systemControl &control, const grainShape& grains); ~grainFluidParticles() override = default; diff --git a/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp b/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp index 29e2fff4..9a87d8db 100644 --- a/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp +++ b/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp @@ -74,13 +74,19 @@ pFlow::sphereDEMSystem::sphereDEMSystem( property_ = makeUnique( propertyFile__, Control().caseSetup().path()); + REPORT(0)<< "\nCreating surface geometry for sphereDEMSystem . . . "<( + pFlow::shapeFile__, + &Control().caseSetup(), + Property()); REPORT(0)<<"\nReading sphere particles . . ."<(Control(), Property()); + particles_ = makeUnique(Control(), spheres_()); insertion_ = makeUnique( diff --git a/DEMSystems/sphereDEMSystem/sphereDEMSystem.hpp b/DEMSystems/sphereDEMSystem/sphereDEMSystem.hpp index b2092490..1b6ab072 100644 --- a/DEMSystems/sphereDEMSystem/sphereDEMSystem.hpp +++ b/DEMSystems/sphereDEMSystem/sphereDEMSystem.hpp @@ -46,6 +46,8 @@ protected: uniquePtr geometry_ = nullptr; + uniquePtr spheres_ = nullptr; + uniquePtr particles_ = nullptr; uniquePtr insertion_ = nullptr; diff --git a/DEMSystems/sphereDEMSystem/sphereFluidParticles.cpp b/DEMSystems/sphereDEMSystem/sphereFluidParticles.cpp index 11c9df24..f3ce902c 100644 --- a/DEMSystems/sphereDEMSystem/sphereFluidParticles.cpp +++ b/DEMSystems/sphereDEMSystem/sphereFluidParticles.cpp @@ -32,8 +32,8 @@ void pFlow::sphereFluidParticles::checkHostMemory() pFlow::sphereFluidParticles::sphereFluidParticles( systemControl &control, - const property &prop) - : sphereParticles(control, prop), + const sphereShape& shpShape) + : sphereParticles(control, shpShape), fluidForce_( objectFile( "fluidForce", diff --git a/DEMSystems/sphereDEMSystem/sphereFluidParticles.hpp b/DEMSystems/sphereDEMSystem/sphereFluidParticles.hpp index d8ae9f58..6a6cd445 100644 --- a/DEMSystems/sphereDEMSystem/sphereFluidParticles.hpp +++ b/DEMSystems/sphereDEMSystem/sphereFluidParticles.hpp @@ -66,7 +66,7 @@ protected: public: /// construct from systemControl and property - sphereFluidParticles(systemControl &control, const property& prop); + sphereFluidParticles(systemControl &control, const sphereShape& shpShape); /// before iteration step bool beforeIteration() override; diff --git a/solvers/grainGranFlow/createDEMComponents.hpp b/solvers/grainGranFlow/createDEMComponents.hpp index a92ed5c4..4199e998 100755 --- a/solvers/grainGranFlow/createDEMComponents.hpp +++ b/solvers/grainGranFlow/createDEMComponents.hpp @@ -17,10 +17,17 @@ Licence: implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -----------------------------------------------------------------------------*/ +REPORT(0)<<"Reading shape dictionary ..."<(-1), - static_cast(-1) - ),*/ + dynPointStruct_(control, shapes.maxBoundingSphere()), shapeIndex_( objectFile( "shapeIndex", diff --git a/src/Particles/particles/particles.hpp b/src/Particles/particles/particles.hpp index 12e3da8c..675604b9 100644 --- a/src/Particles/particles/particles.hpp +++ b/src/Particles/particles/particles.hpp @@ -25,11 +25,14 @@ PARTICULAR PURPOSE. #include "demComponent.hpp" #include "dynamicPointStructure.hpp" #include "particleIdHandler.hpp" -#include "shape.hpp" +//#include "shape.hpp" namespace pFlow { + +class shape; + class particles : public observer , public demComponent @@ -96,7 +99,7 @@ public: // type info TypeInfo("particles"); - explicit particles(systemControl& control); + explicit particles(systemControl& control, const shape& shapes); inline const auto& dynPointStruct() const { diff --git a/src/Particles/particles/shape/shape.hpp b/src/Particles/particles/shape/shape.hpp index 6a0f44b8..5a4007aa 100644 --- a/src/Particles/particles/shape/shape.hpp +++ b/src/Particles/particles/shape/shape.hpp @@ -37,7 +37,7 @@ private: const property& property_; /// list of property ids of shapes (index) - uint32Vector shapePropertyIds_; + uint32Vector shapePropertyIds_; /// list of material names wordVector materialNames_; diff --git a/src/phasicFlow/structuredData/domain/regularSimulationDomain.cpp b/src/phasicFlow/structuredData/domain/regularSimulationDomain.cpp index 7bda6142..ef691650 100644 --- a/src/phasicFlow/structuredData/domain/regularSimulationDomain.cpp +++ b/src/phasicFlow/structuredData/domain/regularSimulationDomain.cpp @@ -72,10 +72,11 @@ bool pFlow::regularSimulationDomain::setThisDomain() pFlow::regularSimulationDomain::regularSimulationDomain ( - systemControl& control + systemControl& control, + real maxBsphere ) : - simulationDomain(control) + simulationDomain(control, maxBsphere) {} bool pFlow::regularSimulationDomain::initialUpdateDomains(span pointPos) diff --git a/src/phasicFlow/structuredData/domain/regularSimulationDomain.hpp b/src/phasicFlow/structuredData/domain/regularSimulationDomain.hpp index 5eb23619..e8181eef 100644 --- a/src/phasicFlow/structuredData/domain/regularSimulationDomain.hpp +++ b/src/phasicFlow/structuredData/domain/regularSimulationDomain.hpp @@ -44,7 +44,7 @@ public: TypeInfo("simulationDomain"); - explicit regularSimulationDomain(systemControl& control); + explicit regularSimulationDomain(systemControl& control, real maxBsphere); ~regularSimulationDomain() final = default; diff --git a/src/phasicFlow/structuredData/domain/simulationDomain.cpp b/src/phasicFlow/structuredData/domain/simulationDomain.cpp index 5851804f..edc0d475 100644 --- a/src/phasicFlow/structuredData/domain/simulationDomain.cpp +++ b/src/phasicFlow/structuredData/domain/simulationDomain.cpp @@ -28,12 +28,14 @@ bool pFlow::simulationDomain::prepareBoundaryDicts() dictionary& boundaries = this->subDict("boundaries"); - real neighborLength = boundaries.getVal("neighborLength"); - real boundaryExtntionLengthRatio = boundaries.getValOrSetMax("boundaryExtntionLengthRatio", static_cast(0.1)); - uint32 updateInterval = + real neighborLength = boundaries.getValOrSetMax( + "neighborLength", + (1+boundaryExtntionLengthRatio)*maxBoundingSphere_); + + uint32 updateInterval = boundaries.getValOrSetMax("updateInterval", 1u); uint32 neighborListUpdateInterval = @@ -82,7 +84,7 @@ bool pFlow::simulationDomain::prepareBoundaryDicts() return true; } -pFlow::simulationDomain::simulationDomain(systemControl &control) +pFlow::simulationDomain::simulationDomain(systemControl &control, real maxBSphere) : fileDictionary( objectFile( domainFile__, @@ -90,9 +92,10 @@ pFlow::simulationDomain::simulationDomain(systemControl &control) objectFile::READ_ALWAYS, objectFile::WRITE_NEVER), &control.settings()), - globalBox_(subDict("globalBox")) + globalBox_(subDict("globalBox")), + maxBoundingSphere_(maxBSphere) { - if( !prepareBoundaryDicts() ) + if( !prepareBoundaryDicts() ) { fatalErrorInFunction<< "Error in preparing dictionaries for boundaries"< -pFlow::simulationDomain::create(systemControl& control) +pFlow::simulationDomain::create(systemControl& control, real maxBSphere) { word sType = angleBracketsNames( "simulationDomain", pFlowProcessors().localRunTypeName()); - if( systemControlvCtorSelector_.search(sType) ) { - return systemControlvCtorSelector_[sType] (control); + return systemControlvCtorSelector_[sType] (control, maxBSphere); } else { diff --git a/src/phasicFlow/structuredData/domain/simulationDomain.hpp b/src/phasicFlow/structuredData/domain/simulationDomain.hpp index dd4d42c9..81423318 100644 --- a/src/phasicFlow/structuredData/domain/simulationDomain.hpp +++ b/src/phasicFlow/structuredData/domain/simulationDomain.hpp @@ -44,6 +44,7 @@ private: /// @brief acutal limits of the global box of simulation box globalBox_; + real maxBoundingSphere_; static constexpr uint32 sizeOfBoundaries_ = 6; static @@ -70,7 +71,7 @@ public: TypeInfo("simulationDomain"); /// Constrcut from components - explicit simulationDomain(systemControl& control); + explicit simulationDomain(systemControl& control, real maxBSphere); /// Destructor ~simulationDomain() override = default; @@ -80,8 +81,8 @@ public: ( simulationDomain, systemControl, - (systemControl& control), - (control) + (systemControl& control, real maxBSphere), + (control, maxBSphere) ); const auto& globalBox()const @@ -189,7 +190,7 @@ public: const plane& boundaryPlane(uint32 i)const; static - uniquePtr create(systemControl& control); + uniquePtr create(systemControl& control, real maxBSphere); /// @brief Boundary name based on boundary index /// @param i boundary index (range from 0 to 5) diff --git a/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.cpp b/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.cpp index 30609b5a..1f19e0ec 100644 --- a/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.cpp +++ b/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.cpp @@ -92,7 +92,8 @@ bool pFlow::pointStructure::initializePoints(const PointsTypeHost &points) pFlow::pointStructure::pointStructure ( - systemControl& control + systemControl& control, + real maxBSphere ) : IOobject @@ -111,7 +112,7 @@ pFlow::pointStructure::pointStructure internalPoints(), simulationDomain_ ( - simulationDomain::create(control) + simulationDomain::create(control, maxBSphere) ), //pointSorting_(simulationDomain_->subDictOrCreate("pointSorting")), boundaries_ @@ -137,6 +138,7 @@ pFlow::pointStructure::pointStructure pFlow::pointStructure::pointStructure( systemControl& control, + real maxBSphere, const realx3Vector &posVec) : IOobject @@ -155,7 +157,7 @@ pFlow::pointStructure::pointStructure( internalPoints(), simulationDomain_ ( - simulationDomain::create(control) + simulationDomain::create(control, maxBSphere) ), //pointSorting_(simulationDomain_->subDictOrCreate("pointSorting")), boundaries_ diff --git a/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.hpp b/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.hpp index 929c7473..e0064584 100644 --- a/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.hpp +++ b/src/phasicFlow/structuredData/pointStructure/pointStructure/pointStructure.hpp @@ -80,11 +80,12 @@ public: //// - Constructors /// an empty pointStructure, good for reading from file - explicit pointStructure(systemControl& control); + explicit pointStructure(systemControl& control, real maxBSphere); /// construct from point positions, assume all points are active pointStructure( systemControl& control, + real maxBSphere, const realx3Vector& posVec); pointStructure(const pointStructure&) = delete; diff --git a/utilities/pFlowToVTK/pointFieldToVTK.cpp b/utilities/pFlowToVTK/pointFieldToVTK.cpp index e376cf27..34dfcf6b 100644 --- a/utilities/pFlowToVTK/pointFieldToVTK.cpp +++ b/utilities/pFlowToVTK/pointFieldToVTK.cpp @@ -57,7 +57,7 @@ bool pFlow::PFtoVTK::convertTimeFolderPointFields( filename = vtk.fileName().wordPath(); REPORT(1); - auto pStruct = pointStructure(control); + auto pStruct = pointStructure(control, 0.0005); // get a list of files in this timeFolder; @@ -146,7 +146,7 @@ bool pFlow::PFtoVTK::convertTimeFolderPointFieldsSelected( filename = vtk.fileName().wordPath(); REPORT(1); - auto pStruct = pointStructure(control); + auto pStruct = pointStructure(control, 0.0005); // get a list of files in this timeFolder; diff --git a/utilities/particlesPhasicFlow/particlesPhasicFlow.cpp b/utilities/particlesPhasicFlow/particlesPhasicFlow.cpp index 9729e27a..00125893 100755 --- a/utilities/particlesPhasicFlow/particlesPhasicFlow.cpp +++ b/utilities/particlesPhasicFlow/particlesPhasicFlow.cpp @@ -88,7 +88,7 @@ int main( int argc, char* argv[] ) auto finalPos = pointPosition().getFinalPosition(); - pStructPtr = pFlow::makeUnique(Control, finalPos); + pStructPtr = pFlow::makeUnique(Control, 0.0005, finalPos); REPORT(1)<< "Created pStruct with "<< pStructPtr().size() << " points and capacity "<< @@ -98,7 +98,7 @@ int main( int argc, char* argv[] ) else { // read the content of pStruct from 0/pStructure - pStructPtr = pFlow::makeUnique(Control); + pStructPtr = pFlow::makeUnique(Control, 0.0005); } diff --git a/utilities/postprocessPhasicFlow/postprocess.cpp b/utilities/postprocessPhasicFlow/postprocess.cpp index dbee2a39..fd9076f3 100644 --- a/utilities/postprocessPhasicFlow/postprocess.cpp +++ b/utilities/postprocessPhasicFlow/postprocess.cpp @@ -65,7 +65,7 @@ bool pFlow::postprocess::processTimeFolder(real time, const word& tName, const f control_.time().setTime(time); REPORT(1)<<"Reading pointStructure"<