From 853d50e96f446ac5badb468221472121f621086d Mon Sep 17 00:00:00 2001 From: hamidrezanorouzi Date: Sat, 24 Dec 2022 15:00:00 +0330 Subject: [PATCH] correction in the macros to be compatible with OpenFOAM --- DEMSystems/CMakeLists.txt | 2 + DEMSystems/DEMSystem/DEMSystem.cpp | 75 ++++++++++ DEMSystems/DEMSystem/DEMSystem.hpp | 128 ++++++++++++++++++ .../domainDistribute/domainDistribute.cpp | 101 ++++++++++++++ .../domainDistribute/domainDistribute.hpp | 89 ++++++++++++ .../sphereDEMSystem/sphereDEMSystem.cpp | 78 ++++++++--- .../sphereDEMSystem/sphereDEMSystem.hpp | 76 +++++------ .../sphereGranFlow/createDEMComponents.hpp | 6 +- solvers/sphereGranFlow/sphereGranFlow.cpp | 4 +- src/Geometry/geometry/geometry.cpp | 10 +- .../geometryMotion/geometryMotion.cpp | 4 +- .../Models/contactForce/linearCF.hpp | 4 +- .../Models/contactForce/nonLinearCF.hpp | 4 +- .../Models/contactForce/nonLinearMod.hpp | 2 +- .../ContactSearch/ContactSearch.hpp | 8 +- .../contactSearch/contactSearch.cpp | 4 +- .../contactSearch/methods/NBSLevel0.hpp | 4 +- .../contactSearch/methods/NBSLevels.hpp | 10 +- .../wallMappings/cellsWallLevel0.hpp | 4 +- .../wallMappings/cellsWallLevels.hpp | 4 +- .../wallMappings/multiGridMapping.hpp | 4 +- src/Interaction/interaction/interaction.cpp | 4 +- .../sphereInteraction/sphereInteraction.cpp | 2 +- .../rotatingAxisMotion/rotatingAxisMotion.cpp | 2 +- .../Insertion/Insertion/Insertion.cpp | 20 +-- .../InsertionRegion/InsertionRegion.cpp | 2 +- .../Insertion/insertion/insertion.cpp | 8 +- .../Insertion/shapeMixture/shapeMixture.cpp | 6 +- .../sphereParticles/sphereParticles.cpp | 28 ++-- .../dynamicPointStructure.cpp | 8 +- src/Particles/particles/particleIdHandler.hpp | 2 +- src/phasicFlow/Kokkos/KokkosTypes.hpp | 2 +- src/phasicFlow/containers/Vector/Vector.cpp | 8 +- .../containers/Vector/VectorAlgorithm.hpp | 2 +- .../pointField/pointFieldAlgorithms.hpp | 14 +- src/phasicFlow/globals/error.hpp | 4 +- src/phasicFlow/globals/pFlowMacros.hpp | 2 +- src/phasicFlow/repository/Time/Time.cpp | 2 +- .../repository/Time/timeControl.hpp | 2 +- .../repository/repository/repository.cpp | 2 +- .../setFieldList/setFieldEntryTemplates.cpp | 16 +-- src/phasicFlow/streams/streams.hpp | 17 +-- src/phasicFlow/structuredData/box/box.hpp | 5 + .../pointStructure/pointStructure.cpp | 4 +- .../selectors/selectBox/selectBox.cpp | 2 +- .../trisurfaceStructure/multiTriSurface.cpp | 4 +- src/setHelpers/initialize.hpp | 6 +- src/setHelpers/initialize_Control.hpp | 2 +- src/setHelpers/setProperty.hpp | 2 +- src/setHelpers/setSurfaceGeometry.hpp | 2 +- utilities/checkPhasicFlow/checkPhasicFlow.cpp | 4 +- .../geometryPhasicFlow/geometryPhasicFlow.cpp | 16 +-- utilities/pFlowToVTK/geometric.hpp | 2 +- utilities/pFlowToVTK/pointFieldToVTK.hpp | 16 +-- utilities/pFlowToVTK/triSurfaceFieldToVTK.hpp | 4 +- .../particlesPhasicFlow.cpp | 22 +-- .../positionParticles/positionParticles.cpp | 2 +- .../positionRandom/positionRandom.cpp | 10 +- .../postprocessPhasicFlow/includeMask.cpp | 2 +- .../postprocessPhasicFlow/postprocess.cpp | 16 +-- .../postprocessPhasicFlow/processField.cpp | 2 +- 61 files changed, 670 insertions(+), 227 deletions(-) create mode 100644 DEMSystems/DEMSystem/DEMSystem.cpp create mode 100644 DEMSystems/DEMSystem/DEMSystem.hpp create mode 100644 DEMSystems/domainDistribute/domainDistribute.cpp create mode 100644 DEMSystems/domainDistribute/domainDistribute.hpp diff --git a/DEMSystems/CMakeLists.txt b/DEMSystems/CMakeLists.txt index 156e23bd..243df700 100644 --- a/DEMSystems/CMakeLists.txt +++ b/DEMSystems/CMakeLists.txt @@ -1,6 +1,8 @@ set(SourceFiles +DEMSystem/DEMSystem.cpp sphereDEMSystem/sphereDEMSystem.cpp +domainDistribute/domainDistribute.cpp ) set(link_libs Kokkos::kokkos phasicFlow Particles Geometry Property Interaction Interaction Utilities) diff --git a/DEMSystems/DEMSystem/DEMSystem.cpp b/DEMSystems/DEMSystem/DEMSystem.cpp new file mode 100644 index 00000000..9c9b0c02 --- /dev/null +++ b/DEMSystems/DEMSystem/DEMSystem.cpp @@ -0,0 +1,75 @@ +/*------------------------------- 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. + +-----------------------------------------------------------------------------*/ + +#include "DEMSystem.hpp" + + +pFlow::coupling::DEMSystem::DEMSystem( + word demSystemName, + int32 numDomains, + const std::vector& domains, + int argc, + char* argv[]) +: + ControlDict_(), + domains_(domains) +{ + + REPORT(0)<<"\nCreating Control repository . . ."<( + ControlDict_.startTime(), + ControlDict_.endTime(), + ControlDict_.saveInterval(), + ControlDict_.startTimeName()); + +} + +pFlow::coupling::DEMSystem::~DEMSystem() +{} + + +pFlow::uniquePtr + pFlow::coupling::DEMSystem::create( + word demSystemName, + int32 numDomains, + const std::vector& domains, + int argc, + char* argv[] + ) +{ + if( wordvCtorSelector_.search(demSystemName) ) + { + return wordvCtorSelector_[demSystemName] (demSystemName, numDomains, domains, argc, argv); + } + else + { + printKeys + ( + fatalError << "Ctor Selector "<< demSystemName << " dose not exist. \n" + <<"Avaiable ones are: \n\n" + , + wordvCtorSelector_ + ); + return nullptr; + } + + return nullptr; +} + diff --git a/DEMSystems/DEMSystem/DEMSystem.hpp b/DEMSystems/DEMSystem/DEMSystem.hpp new file mode 100644 index 00000000..a2731261 --- /dev/null +++ b/DEMSystems/DEMSystem/DEMSystem.hpp @@ -0,0 +1,128 @@ +/*------------------------------- 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. + +-----------------------------------------------------------------------------*/ + +#ifndef __DEMSystem_hpp__ +#define __DEMSystem_hpp__ + +#include + +#include "types.hpp" +#include "virtualConstructor.hpp" +#include "uniquePtr.hpp" +#include "systemControl.hpp" +#include "readControlDict.hpp" + + +namespace pFlow::coupling +{ + + +class DEMSystem +{ +protected: + + readControlDict ControlDict_; + + uniquePtr Control_ = nullptr; + + std::vector domains_; + + + // methods + auto& Control() + { + return Control_(); + } + + +public: + + TypeInfo("DEMSystem"); + + DEMSystem( + word demSystemName, + int32 numDomains, + const std::vector& domains, + int argc, + char* argv[]); + + virtual ~DEMSystem(); + + DEMSystem(const DEMSystem&)=delete; + + DEMSystem& operator = (const DEMSystem&)=delete; + + create_vCtor( + DEMSystem, + word, + ( + word demSystemName, + int32 numDomains, + const std::vector& domains, + int argc, + char* argv[] + ), + ( + demSystemName, + numDomains, + domains, + argc, + argv + )); + + realx3 g()const + { + return Control_->g(); + } + + auto inline constexpr usingDoulle()const + { + return pFlow::usingDouble__; + } + + virtual + int32 numParInDomain(int32 di)const = 0; + + virtual + std::vector numParInDomain()const = 0; + + virtual + bool iterate(int32 n, real timeToWrite, word timeName) = 0; + + virtual + real maxBounndingSphereSize()const = 0; + + static + uniquePtr + create( + word demSystemName, + int32 numDomains, + const std::vector& domains, + int argc, + char* argv[]); + + + +}; + + +} // pFlow + +#endif // __DEMSystem_hpp__ \ No newline at end of file diff --git a/DEMSystems/domainDistribute/domainDistribute.cpp b/DEMSystems/domainDistribute/domainDistribute.cpp new file mode 100644 index 00000000..18e43832 --- /dev/null +++ b/DEMSystems/domainDistribute/domainDistribute.cpp @@ -0,0 +1,101 @@ +/*------------------------------- 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. + +-----------------------------------------------------------------------------*/ + +#include "domainDistribute.hpp" + + + +pFlow::coupling::domainDistribute::domainDistribute( + int32 numDomains, + const Vector& domains_, + real maxBoundingBox) +: +numDomains_(numDomains), +extDomains_("extDomains", numDomains), +particlesInDomains_("particlesInDomains", numDomains), +numParInDomain_("numParInDomain", numDomains, 0), +maxBoundingBoxSize_(maxBoundingBox) +{ + + realx3 dl = domainExtension_ * maxBoundingBoxSize_; + + for(int32 i=0; i points, includeMask mask) + { + range active = mask.activeRange(); + auto numInDomain = numParInDomain_.deviceVectorAll(); + auto numDomains = numDomains_; + + using policy = Kokkos::RangePolicy< + DefaultHostExecutionSpace, + Kokkos::IndexType >; + + Kokkos::parallel_for("locateParticles", + policy(active.first, active.second), + LAMBDA_HD(int32 i){ + if(mask(i)) + { + for(int32 di=0; di extDomains_; + + Vector> particlesInDomains_; + + int32Vector_H numParInDomain_; + + + real maxBoundingBoxSize_; + + int32 lastUpdateIter_ = 0; + + int32 updateInterval_ = 1; + + real domainExtension_ = 1.0; + + using includeMask = typename pointStructure::activePointsHost; + +public: + + domainDistribute( + int32 numDomains, + const Vector& domains_, + real maxBoundinBox); + + ~domainDistribute()=default; + + domainDistribute(const domainDistribute&)=delete; + + domainDistribute& operator=(const domainDistribute&)=delete; + + int32 numDomains()const + { + return numDomains_; + } + + int32 numParInDomain(int32 di)const + { + return numParInDomain_[di]; + } + + //template + bool locateParticles( + ViewType1D points, includeMask mask); + +}; + + +} // pFlow::coupling + +#endif //__domainDistribute_hpp__ \ No newline at end of file diff --git a/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp b/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp index 9d145494..14139f18 100644 --- a/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp +++ b/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp @@ -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& 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())<( - ControlDict_.startTime(), - ControlDict_.endTime(), - ControlDict_.saveInterval(), - ControlDict_.startTimeName()); + - Report(0)<<"\nReading proprties . . . "<( Control().caseSetup().path()+propertyFile__); - Report(0)<< "\nCreating surface geometry for sphereDEMSystem . . . "<(Control(), Property()); - //Report(0)<<"\nCreating particle insertion for spheres. . ."<( 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 . . ."<boundingSphereMinMax(minD, maxD); + + particleDistribution_ = makeUnique(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::coupling::sphereDEMSystem::numParInDomain()const +{ + const auto& distribute = particleDistribution_(); + int32 numDomains = distribute.numDomains(); + std::vector nums(numDomains); + for(int32 i=0; iboundingSphereMinMax(minD, maxD); + + return maxD; +} \ No newline at end of file diff --git a/DEMSystems/sphereDEMSystem/sphereDEMSystem.hpp b/DEMSystems/sphereDEMSystem/sphereDEMSystem.hpp index e6233bdd..5ddc04e5 100644 --- a/DEMSystems/sphereDEMSystem/sphereDEMSystem.hpp +++ b/DEMSystems/sphereDEMSystem/sphereDEMSystem.hpp @@ -21,54 +21,40 @@ Licence: #ifndef __sphereDEMSystem_hpp__ #define __sphereDEMSystem_hpp__ -#include - -#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 Control_ = nullptr; + uniquePtr property_ = nullptr; - uniquePtr property_ = nullptr; - - uniquePtr geometry_ = nullptr; + uniquePtr geometry_ = nullptr; uniquePtr particles_ = nullptr; uniquePtr insertion_ = nullptr; - uniquePtr interaction_ = nullptr; + uniquePtr interaction_ = nullptr; + uniquePtr particleDistribution_=nullptr; - int32 numDomains_; - - VectorDual domains_; - - Vector 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& domains, + int argc, + char* argv[]); + + virtual ~sphereDEMSystem(); sphereDEMSystem(const sphereDEMSystem&)=delete; sphereDEMSystem& operator = (const sphereDEMSystem&)=delete; - - std::array 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 numParInDomain()const override; + + + virtual + bool iterate(int32 n, real timeToWrite, word timeName) override; + + virtual + real maxBounndingSphereSize()const override; }; diff --git a/solvers/sphereGranFlow/createDEMComponents.hpp b/solvers/sphereGranFlow/createDEMComponents.hpp index a407a9e1..b4ade9c8 100755 --- a/solvers/sphereGranFlow/createDEMComponents.hpp +++ b/solvers/sphereGranFlow/createDEMComponents.hpp @@ -19,11 +19,11 @@ Licence: -----------------------------------------------------------------------------*/ // -Report(0)<<"\nReading sphere particles . . ."<( objectFile( @@ -38,7 +38,7 @@ auto& sphInsertion = -Report(0)<<"\nCreating interaction model for sphere-sphere contact and sphere-wall contact . . ."< auto geomModel = angleBracketsNames("geometry", model); - Report(1)<< "Selecting geometry model . . ."< auto geomModel = angleBracketsNames("geometry", model); - Report(1)<< "Selecting geometry model . . ."< motionCompName, propName ); - Report(2)<<"Model "<< greenText(geomModel)<<" is created.\n"<::findMotionIndex() triMotionIndex_.reserve( this->surface().capacity() ); triMotionIndex_.clear(); - forAll( surfI, motionComponentName_) + ForAll( surfI, motionComponentName_) { auto mName = motionComponentName_[surfI]; auto mInd = motionModel_.nameToIndex(mName); @@ -71,7 +71,7 @@ bool pFlow::geometryMotion::findMotionIndex() pointMotionIndex_.reserve(triSurface_.numPoints()); pointMotionIndex_.clear(); - forAll(surfI, motionIndex_) + ForAll(surfI, motionIndex_) { auto nP = triSurface_.surfNumPoints(surfI); for(int32 i=0; i prop(nElem); - forAll(i,kn) + ForAll(i,kn) { prop[i] = {kn[i], kt[i], etha_n[i], etha_t[i], mu[i]}; } diff --git a/src/Interaction/Models/contactForce/nonLinearCF.hpp b/src/Interaction/Models/contactForce/nonLinearCF.hpp index 5e7f27f3..b9f42d69 100644 --- a/src/Interaction/Models/contactForce/nonLinearCF.hpp +++ b/src/Interaction/Models/contactForce/nonLinearCF.hpp @@ -123,7 +123,7 @@ protected: realVector etha_n(nElem); - forAll(i , en) + ForAll(i , en) { //K_hertz = 4.0/3.0*Yeff*sqrt(Reff); //-2.2664*log(en)*sqrt(meff*K_hertz)/sqrt( log(en)**2 + 10.1354); @@ -138,7 +138,7 @@ protected: } Vector prop(nElem); - forAll(i,Yeff) + ForAll(i,Yeff) { prop[i] = {Yeff[i], Geff[i], etha_n[i], mu[i]}; } diff --git a/src/Interaction/Models/contactForce/nonLinearMod.hpp b/src/Interaction/Models/contactForce/nonLinearMod.hpp index c9dbdfa9..3bfbd29b 100644 --- a/src/Interaction/Models/contactForce/nonLinearMod.hpp +++ b/src/Interaction/Models/contactForce/nonLinearMod.hpp @@ -122,7 +122,7 @@ protected: Vector prop(nElem); - forAll(i,Yeff) + ForAll(i,Yeff) { prop[i] = {Yeff[i], Geff[i], etha_n[i], mu[i]}; } diff --git a/src/Interaction/contactSearch/ContactSearch/ContactSearch.hpp b/src/Interaction/contactSearch/ContactSearch/ContactSearch.hpp index d8065d94..d6428064 100644 --- a/src/Interaction/contactSearch/ContactSearch/ContactSearch.hpp +++ b/src/Interaction/contactSearch/ContactSearch/ContactSearch.hpp @@ -98,8 +98,8 @@ public: position, diam ); - Report(2)<<"Contact search algorithm for particle-particle is "<< - greenText(particleContactSearch_().typeName())< pFlow::contactSearch::create( auto model = angleBracketsNames2("ContactSearch", baseMethName, wallMethod); - Report(1)<<"Selecting contact search model . . ."< pFlow::interaction::create clType); - Report(1)<< "Selecting interaction model..."<fileDict().subDict("model"); - Report(1)<<"Createing contact force model . . ."<( this->numMaterials(), rhoD.deviceVector(), diff --git a/src/MotionModel/rotatingAxisMotion/rotatingAxisMotion.cpp b/src/MotionModel/rotatingAxisMotion/rotatingAxisMotion.cpp index 8d8fa3c7..9ef21e44 100644 --- a/src/MotionModel/rotatingAxisMotion/rotatingAxisMotion.cpp +++ b/src/MotionModel/rotatingAxisMotion/rotatingAxisMotion.cpp @@ -96,7 +96,7 @@ bool pFlow::rotatingAxisMotion::writeDictionary auto& motionInfo = dict.subDictOrCreate("rotatingAxisMotionInfo"); - forAll(i, axis_) + ForAll(i, axis_) { auto& axDict = motionInfo.subDictOrCreate(axisName_[i]); diff --git a/src/Particles/Insertion/Insertion/Insertion.cpp b/src/Particles/Insertion/Insertion/Insertion.cpp index 08a7f4b9..a8a406e3 100644 --- a/src/Particles/Insertion/Insertion/Insertion.cpp +++ b/src/Particles/Insertion/Insertion/Insertion.cpp @@ -37,7 +37,7 @@ bool pFlow::Insertion::readInsertionDict for(auto& name:regionDicNames) { - Report(2)<<"reading insertion region "<< greenText(name)<::writeInsertionDict if( !this->isActive() ) return true; - forAll(i,regions_) + ForAll(i,regions_) { auto& rgnDict = dict.subDictOrCreate(regions_[i].name()); @@ -92,7 +92,7 @@ bool pFlow::Insertion::insertParticles if(!isActive()) return true; - forAll(i,regions_) + ForAll(i,regions_) { bool insertionOccured = false; auto& rgn = regions_[i]; @@ -106,9 +106,9 @@ bool pFlow::Insertion::insertParticles if(insertionOccured) { - Report(0)<<"\nParticle insertion from "<< greenText(rgn.name())<::insertParticles " to particles. \n"; return false; } - Report(1)<<"Total number of particles inserted from this region is "<< - cyanText(rgn.totalInserted())<<'\n'<::insertParticles { if(insertionOccured) { - Warning<< "\n fewer number of particles are inserted from region "<< rgn.name() << - " than expected. You may stop the simulation to change settings."<::checkForContact ) { - forAll(i, pos) + ForAll(i, pos) { if( length(pos[i]-p) < 0.5*(diams[i]+d) ) return true; } diff --git a/src/Particles/Insertion/insertion/insertion.cpp b/src/Particles/Insertion/insertion/insertion.cpp index 441eb9ab..5737d521 100644 --- a/src/Particles/Insertion/insertion/insertion.cpp +++ b/src/Particles/Insertion/insertion/insertion.cpp @@ -33,11 +33,11 @@ bool pFlow::insertion::readInsertionDict active_ = dict.getVal("active"); if(active_) - Report(1)<< "Particle insertion mechanism is "<< - yellowText("active")<<" in the simulation."<dt(), accelertion_); - //Info<<"after dyn predict"<dt(),rVelocity_, rAcceleration_); - //Info<<"after rvel predict"<dt(), accelertion_); - //Info<<"after correct dyn "<dt(), rVelocity_, rAcceleration_); - //Info<<"after correct rvel "<integrationMethod()) - << " for rotational velocity."<integrationMethod()) + << " for rotational velocity."<setInitialVals(indexHD, rvel); } @@ -400,9 +400,9 @@ bool pFlow::sphereParticles::insertParticles auto activeR = this->activeRange(); - Report(1)<< "Active range is "<numActive())<< - " and pointStructure capacity is "<capacity())<capacity())<subscribe(pStruct()); - Report(1)<< "Creating integration method "<< - greenText(integrationMethod_)<<" for dynamicPointStructure."<setInitialVals(indexHD, pos); - Report(2)<< "Initializing the required vectors for velocity integratoin\n "<setInitialVals(indexHD, vel); } diff --git a/src/Particles/particles/particleIdHandler.hpp b/src/Particles/particles/particleIdHandler.hpp index 1e2e6d33..abe708b4 100644 --- a/src/Particles/particles/particleIdHandler.hpp +++ b/src/Particles/particles/particleIdHandler.hpp @@ -45,7 +45,7 @@ public: nextId_ = 0; id.modifyOnHost(); - forAll(i,id) + ForAll(i,id) { if(id.isActive(i)) { diff --git a/src/phasicFlow/Kokkos/KokkosTypes.hpp b/src/phasicFlow/Kokkos/KokkosTypes.hpp index 74bca64f..b378124d 100644 --- a/src/phasicFlow/Kokkos/KokkosTypes.hpp +++ b/src/phasicFlow/Kokkos/KokkosTypes.hpp @@ -62,7 +62,7 @@ template using ViewType1D = Kokkos::View; template - using DualViewType1D = Kokkos::View; + using DualViewType1D = Kokkos::DualView; template using ViewType3D = Kokkos::View; diff --git a/src/phasicFlow/containers/Vector/Vector.cpp b/src/phasicFlow/containers/Vector/Vector.cpp index 80c942c6..f644fc25 100644 --- a/src/phasicFlow/containers/Vector/Vector.cpp +++ b/src/phasicFlow/containers/Vector/Vector.cpp @@ -208,7 +208,7 @@ bool pFlow::Vector::insertSetElement( auto hIndices = indices.hostView(); - forAll(i, indices) + ForAll(i, indices) { auto s = size(); auto idx = hIndices[i]; @@ -240,7 +240,7 @@ bool pFlow::Vector::insertSetElement( auto hIndices = indices.hostView(); - forAll(i, indices) + ForAll(i, indices) { auto s = size(); auto idx = hIndices[i]; @@ -271,7 +271,7 @@ bool pFlow::Vector::insertSetElement { if(indices.size() == 0)return true; - forAll(i, indices) + ForAll(i, indices) { auto s = size(); auto idx = indices[i]; @@ -303,7 +303,7 @@ bool pFlow::Vector::insertSetElement if(indices.size() == 0)return true; if(indices.size() != vals.size())return false; - forAll(i, indices) + ForAll(i, indices) { auto s = size(); auto idx = indices[i]; diff --git a/src/phasicFlow/containers/Vector/VectorAlgorithm.hpp b/src/phasicFlow/containers/Vector/VectorAlgorithm.hpp index 80c5b9be..c6dd9bd1 100644 --- a/src/phasicFlow/containers/Vector/VectorAlgorithm.hpp +++ b/src/phasicFlow/containers/Vector/VectorAlgorithm.hpp @@ -68,7 +68,7 @@ inline void sort(Vector& vec) template inline int64 find(Vector& vec, const T& val) { - forAll( i,vec) + ForAll( i,vec) { if ( vec[i] == val) return static_cast(i); } diff --git a/src/phasicFlow/containers/pointField/pointFieldAlgorithms.hpp b/src/phasicFlow/containers/pointField/pointFieldAlgorithms.hpp index 2d38e1bf..022e35f1 100644 --- a/src/phasicFlow/containers/pointField/pointFieldAlgorithms.hpp +++ b/src/phasicFlow/containers/pointField/pointFieldAlgorithms.hpp @@ -181,7 +181,7 @@ T maxActive(const pointField& pField) fill_n(field, field.size(), val); return; } - forAll(i, field) + ForAll(i, field) { if(field.pStruct().isActive(i)) field[i] = val; } @@ -191,7 +191,7 @@ template void inline fillMarkedDelete( pointField& field, const T& val) { if(field.pStruct().allActive())return; - forAll(i,field) + ForAll(i,field) { if(!field.pStruct().isActive(i)) field[i] = val; } @@ -215,14 +215,14 @@ inline auto for_eachActive(pointField& field, UnaryPredicate func) { if(field.pStruct().allActive()) { - forAll(i,field) + ForAll(i,field) { func(i); } } else { - forAll(i, field) + ForAll(i, field) { if(field.pStruct().isActive(i)) func(i); } @@ -235,14 +235,14 @@ inline bool for_eachActiveBreak(pointField& field, UnaryPredicate func) { if(field.pStruct().allActive()) { - forAll(i,field) + ForAll(i,field) { if(!func(i))return false; } } else { - forAll(i, field) + ForAll(i, field) { if(field.pStruct().isActive(i)) { @@ -258,7 +258,7 @@ inline auto for_eachMarkedDelete(pointField& field, UnaryPredicate func) { if(field.pStruct().allActive()) return func; - forAll(i, field) + ForAll(i, field) { if(!field.pStruct().isActive(i)) func(i); } diff --git a/src/phasicFlow/globals/error.hpp b/src/phasicFlow/globals/error.hpp index 0a375725..52f56157 100644 --- a/src/phasicFlow/globals/error.hpp +++ b/src/phasicFlow/globals/error.hpp @@ -41,10 +41,10 @@ namespace pFlow #define fatalErrorInFunction fatalErrorIn(FUNCTION_NAME) -#define notImplemented(functionName) \ +#define Not_Implemented(functionName) \ notImplementedErrorMessage ((functionName), __FILE__, __LINE__ ) -#define notImplementedFunction notImplemented(FUNCTION_NAME); +#define notImplementedFunction Not_Implemented(FUNCTION_NAME); #define ioErrorInFile( fileName, lineNumber) \ ioErrorMessage( fileName, lineNumber, FUNCTION_NAME, __FILE__, __LINE__ ) diff --git a/src/phasicFlow/globals/pFlowMacros.hpp b/src/phasicFlow/globals/pFlowMacros.hpp index f0f78229..fd3a5bf6 100755 --- a/src/phasicFlow/globals/pFlowMacros.hpp +++ b/src/phasicFlow/globals/pFlowMacros.hpp @@ -68,7 +68,7 @@ Licence: #endif -#define forAll(i, container) for(auto i=0; i < container.size(); ++i) +#define ForAll(i, container) for(auto i=0; i < container.size(); ++i) #ifdef USE_STD_PARALLEL_ALG static inline const bool useStdParallel__ = true; diff --git a/src/phasicFlow/repository/Time/Time.cpp b/src/phasicFlow/repository/Time/Time.cpp index ebddd80c..4f80061b 100644 --- a/src/phasicFlow/repository/Time/Time.cpp +++ b/src/phasicFlow/repository/Time/Time.cpp @@ -85,7 +85,7 @@ bool pFlow::Time::write { if(outputToFile()) { - Report(0)<<"\nWriting to file at time: "<< cyanText(currentTimeWord())<(); if(verbose) - Report(2)<<"Creating pointField " << greenText(fieldName())<< " with default value " << cyanText(defValue)<< - " in repository "<< owner.name() <(); if(verbose) - Report(2)<<"Creating pointField " << greenText(fieldName())<< " with default value " << cyanText(defValue)<< - " in repository "<< owner.name() <(); if(verbose) - Report(2)<< "Setting selected points of " << greenText(fName) - << " to value " << cyanText(value) <(); if(verbose) - Report(2)<< "Setting selected points of " << greenText(fName) - << " to value " << cyanText(value) < Info: "< INFO: "< Warning\n"< Error\n"< WARNING\n"< ERROR\n"<>(iIstream& is, box& b); FUNCTION_H iOstream& operator << (iOstream& os, const box& b); +INLINE_FUNCTION_HD +box extendBox(const box& b, const realx3& dl) +{ + return box(b.minPoint()-dl , b.maxPoint()+dl); +} } diff --git a/src/phasicFlow/structuredData/pointStructure/pointStructure.cpp b/src/phasicFlow/structuredData/pointStructure/pointStructure.cpp index 6d1bf57c..6a21e808 100644 --- a/src/phasicFlow/structuredData/pointStructure/pointStructure.cpp +++ b/src/phasicFlow/structuredData/pointStructure/pointStructure.cpp @@ -100,7 +100,7 @@ pFlow::uniquePtr newPoints.clear(); int32 numAdded = 0; - forAll(i, pointFlag_) + ForAll(i, pointFlag_) { if(!isActive(i)) { @@ -469,7 +469,7 @@ pFlow::pointStructure::newPointsIndices( // otherwise scan the points from first to the end to find empty spaces newPoints.clear(); int32 numAdded = 0; - forAll(i, pointFlag_) + ForAll(i, pointFlag_) { if(!isActive(i)) { diff --git a/src/phasicFlow/structuredData/pointStructure/selectors/selectBox/selectBox.cpp b/src/phasicFlow/structuredData/pointStructure/selectors/selectBox/selectBox.cpp index 6dd22236..89e89cfc 100644 --- a/src/phasicFlow/structuredData/pointStructure/selectors/selectBox/selectBox.cpp +++ b/src/phasicFlow/structuredData/pointStructure/selectors/selectBox/selectBox.cpp @@ -33,7 +33,7 @@ void pFlow::selectBox::selectAllPointsInBox() selectedPoints_.clear(); auto pPos = pStruct().pointPosition().hostVector(); - forAll(i , pPos) + ForAll(i , pPos) { if( box_.isInside( pPos[i] )) selectedPoints_.push_back(i); } diff --git a/src/phasicFlow/structuredData/trisurfaceStructure/multiTriSurface.cpp b/src/phasicFlow/structuredData/trisurfaceStructure/multiTriSurface.cpp index 56abdb60..f06d9ed9 100644 --- a/src/phasicFlow/structuredData/trisurfaceStructure/multiTriSurface.cpp +++ b/src/phasicFlow/structuredData/trisurfaceStructure/multiTriSurface.cpp @@ -58,7 +58,7 @@ void pFlow::multiTriSurface::calculateVars() pointsStartPos_.push_back(0); - forAll( i, surfaceNumPoints_) + ForAll( i, surfaceNumPoints_) { if(i==0)continue; @@ -72,7 +72,7 @@ void pFlow::multiTriSurface::calculateVars() verticesStartPos_.clear(); verticesStartPos_.push_back(0); - forAll(i, surfaceNumVertices_) + ForAll(i, surfaceNumVertices_) { if(i==0)continue; verticesStartPos_.push_back(verticesStartPos_[i-1] + surfaceNumVertices_[i-1]); diff --git a/src/setHelpers/initialize.hpp b/src/setHelpers/initialize.hpp index 0b970dfe..8ee05c99 100644 --- a/src/setHelpers/initialize.hpp +++ b/src/setHelpers/initialize.hpp @@ -22,9 +22,9 @@ Licence: #define __initialize_hpp__ // initilized and finalize should be placed in onc scope -Report(0)<<"Initializing host/device execution spaces . . . \n"; -Report(1)<<"Host execution space is "<< greenText(pFlow::DefaultHostExecutionSpace::name())< ControlPtr = nullptr; if(isCoupling) diff --git a/src/setHelpers/setProperty.hpp b/src/setHelpers/setProperty.hpp index 5c85adda..1d09d6aa 100644 --- a/src/setHelpers/setProperty.hpp +++ b/src/setHelpers/setProperty.hpp @@ -22,7 +22,7 @@ Licence: #ifndef __setProperty_hpp__ #define __setProperty_hpp__ -Report(0)<<"\nReading proprties . . . "< ( objectFile @@ -87,26 +87,26 @@ int main( int argc, char* argv[] ) for(auto& name:wallsDictName) { - Report(1)<<"Creating wall "<(); // get a list of files in this timeFolder; - Report(1)<<"Wrting triSurface mesh/Geometry to vtk file."<(); - Report(1)<< "Created pStruct with "<< pSruct.size() << " points and capacity "<< - pSruct.capacity()<<" . . ."<< endReport; + REPORT(1)<< "Created pStruct with "<< pSruct.size() << " points and capacity "<< + pSruct.capacity()<<" . . ."<< endREPORT; - Report(1)<< "Writing pStruct to " << pStructObj().path() << endReport<= numPoints_ ) { - Report(1)<<"Selected "<< cyanText(numPoints_)<< " for the final field.\n"< pFlow::includeMask::create( auto objPtr = dictionaryvCtorSelector_[method] (dict, opType, timeFolder); - Report(2)<< dict.name()<< " with model "< ( @@ -64,7 +64,7 @@ bool pFlow::postprocess::processTimeFolder(real time, const word& tName, const f &control_ ); - Report(1)<<"Reading pointStructure"<( objectFile ( @@ -75,7 +75,7 @@ bool pFlow::postprocess::processTimeFolder(real time, const word& tName, const f )); - Report(1)<<"Creating mesh and point to cell mapper"<( dict_.subDict("rectMesh"), timeFolderReposiory().lookupObject(pointStructureFile__), @@ -125,11 +125,11 @@ bool pFlow::postprocess::writeToVTK(fileSystem destPath, word bName)const if(!vtk) return false; - Report(1)<<"Writing processed fields to vtk file..."<mesh().writeToVtk(vtk()); - forAll( i, processedFields_) + ForAll( i, processedFields_) { if( !processedFields_[i].writeToVTK(vtk())) diff --git a/utilities/postprocessPhasicFlow/processField.cpp b/utilities/postprocessPhasicFlow/processField.cpp index e53f2f2f..2521d535 100644 --- a/utilities/postprocessPhasicFlow/processField.cpp +++ b/utilities/postprocessPhasicFlow/processField.cpp @@ -115,7 +115,7 @@ pFlow::processField::create( auto objPtr = dictionaryvCtorSelector_[method] (dict, pToCell, rep); - Report(2)<<"Processing/creating " << yellowText(dict.name())<< " with model "<