From 6152ec6a7c88e049dc640b777cd9a0aa452df0ec Mon Sep 17 00:00:00 2001 From: hamidrezanorouzi Date: Sat, 10 Sep 2022 17:12:12 +0430 Subject: [PATCH] correted position random --- .../rotatingDrum_1/caseSetup/sphereShape | 2 +- .../rotatingDrum_1/settings/geometryDict | 10 ++-- .../rotatingDrum_1/settings/particlesDict | 10 ++-- .../rotatingDrum_1/settings/settingsDict | 4 +- .../positionParticles/positionParticles.H | 6 ++ .../positionRandom/positionRandom.C | 58 ++++++++++++------- .../positionRandom/positionRandom.H | 11 +++- 7 files changed, 65 insertions(+), 36 deletions(-) diff --git a/benchmarks/rotatingDrum_1/caseSetup/sphereShape b/benchmarks/rotatingDrum_1/caseSetup/sphereShape index 4c02d41f..eab9b617 100755 --- a/benchmarks/rotatingDrum_1/caseSetup/sphereShape +++ b/benchmarks/rotatingDrum_1/caseSetup/sphereShape @@ -7,5 +7,5 @@ objectName sphereDict; objectType sphereShape; names (glassBead); // names of shapes -diameters (0.006); // diameter of shapes +diameters (0.003); // diameter of shapes materials (glassMat); // material names for shapes diff --git a/benchmarks/rotatingDrum_1/settings/geometryDict b/benchmarks/rotatingDrum_1/settings/geometryDict index a01bb327..64702fd8 100644 --- a/benchmarks/rotatingDrum_1/settings/geometryDict +++ b/benchmarks/rotatingDrum_1/settings/geometryDict @@ -15,7 +15,7 @@ surfaces { type cylinderWall; p1 (0.0 0.0 0.0); - p2 (0.0 0.0 0.8); + p2 (0.0 0.0 1.6); radius1 0.2; radius2 0.2; resolution 24; @@ -41,10 +41,10 @@ surfaces wall2 { type planeWall; - p1 (-0.2 -0.2 0.8); - p2 ( 0.2 -0.2 0.8); - p3 ( 0.2 0.2 0.8); - p4 (-0.2 0.2 0.8); + p1 (-0.2 -0.2 1.6); + p2 ( 0.2 -0.2 1.6); + p3 ( 0.2 0.2 1.6); + p4 (-0.2 0.2 1.6); material wallMat; motion rotAxis; } diff --git a/benchmarks/rotatingDrum_1/settings/particlesDict b/benchmarks/rotatingDrum_1/settings/particlesDict index fe5ec556..7ae00511 100644 --- a/benchmarks/rotatingDrum_1/settings/particlesDict +++ b/benchmarks/rotatingDrum_1/settings/particlesDict @@ -25,20 +25,20 @@ positionParticles { method positionOrdered; - maxNumberOfParticles 1000000; + maxNumberOfParticles 4000001; mortonSorting Yes; cylinder // box for positioning particles { - p1 ( 0.0 0.0 0.0); // lower corner point of the box - p2 ( 0.0 0.0 0.8); // upper corner point of the box + p1 ( 0.0 0.0 0.01); // lower corner point of the box + p2 ( 0.0 0.0 1.59); // upper corner point of the box radius 0.195; } positionOrderedInfo { - diameter 0.006; // minimum space between centers of particles - numPoints 240000; // number of particles in the simulation + diameter 0.003; // minimum space between centers of particles + numPoints 4000000; // number of particles in the simulation axisOrder (z x y); // axis order for filling the space with particles } } diff --git a/benchmarks/rotatingDrum_1/settings/settingsDict b/benchmarks/rotatingDrum_1/settings/settingsDict index e02e4a65..8a881847 100644 --- a/benchmarks/rotatingDrum_1/settings/settingsDict +++ b/benchmarks/rotatingDrum_1/settings/settingsDict @@ -21,8 +21,8 @@ g (0 -9.8 0); // gravity vector (m/s2) domain { - min (-0.21 -0.21 -0.01); - max ( 0.21 0.21 0.81); + min (-0.2 -0.2 -0.0); + max ( 0.2 0.2 1.6); } integrationMethod AdamsBashforth3; // integration method diff --git a/utilities/particlesPhasicFlow/positionParticles/positionParticles.H b/utilities/particlesPhasicFlow/positionParticles/positionParticles.H index cdc82706..62ba5322 100755 --- a/utilities/particlesPhasicFlow/positionParticles/positionParticles.H +++ b/utilities/particlesPhasicFlow/positionParticles/positionParticles.H @@ -46,6 +46,7 @@ public: virtual realx3 maxPoint()const =0; + virtual word name()const =0; }; @@ -91,6 +92,11 @@ class region return region_.maxPoint(); } + word name()const override + { + return region_.typeName(); + } + }; class positionParticles diff --git a/utilities/particlesPhasicFlow/positionRandom/positionRandom.C b/utilities/particlesPhasicFlow/positionRandom/positionRandom.C index 628a1903..11ea40dd 100755 --- a/utilities/particlesPhasicFlow/positionRandom/positionRandom.C +++ b/utilities/particlesPhasicFlow/positionRandom/positionRandom.C @@ -21,10 +21,9 @@ Licence: #include "positionRandom.H" #include "uniformRandomReal.H" -#include "VectorSingles.H" -#include "VectorDuals.H" #include "NBS.H" #include "unsortedPairs.H" +#include "box.H" @@ -35,12 +34,6 @@ using SearchType = NBS ; using ContainerType = unsortedPairs; -void fillPoints( - uint numPoints, - realx3 minP, - realx3 maxP, - realx3Vector_HD& points, - int32Vector_HD& flags ); int32 findCollisions( ContainerType& pairs, @@ -70,11 +63,11 @@ bool pFlow::positionRandom::positionOnePass(int32 pass, int32 startNum) int32Vector_HD flagHD(startNum, 0); realx3Vector_HD positionHD(startNum); - auto minP = box_.minPoint() + static_cast(0.5)*realx3(diameter_); - auto maxP = box_.maxPoint() - static_cast(0.5)*realx3(diameter_); + auto minP = region_->minPoint(); + auto maxP = region_->maxPoint(); SearchType search( - box_, + box(minP, maxP), diameter_, positionHD.deviceVectorAll(), diameter.deviceVectorAll()); @@ -85,7 +78,7 @@ bool pFlow::positionRandom::positionOnePass(int32 pass, int32 startNum) greenText("(Pass #"<< pass+1<<")")<< ": started with "<< startNum <<" points."<("numPoints") ), - box_ - ( - prDict_.subDict("box") - ), maxIterations_ ( prDict_.getValOrSet("maxIterations", 10) @@ -201,24 +190,53 @@ pFlow::positionRandom::positionRandom { fatalExit; } + + if(!region_) + { + fatalErrorInFunction<<"You must provided a region (box, cylinder, ...) for positioning particles in dictionary "<< + dict.globalName()<100) + { + fatalErrorInFunction<< + "could not find a point inside region"<name()<