diff --git a/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp b/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp index 8416e505..37f7529f 100644 --- a/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp +++ b/DEMSystems/sphereDEMSystem/sphereDEMSystem.cpp @@ -25,8 +25,6 @@ bool pFlow::sphereDEMSystem::loop() do { - Control().timers().start(); - // if(! insertion_().insertParticles( @@ -55,9 +53,6 @@ bool pFlow::sphereDEMSystem::loop() particles_->afterIteration(); geometry_->afterIteration(); - - - Control().timers().end(); }while(Control()++); @@ -80,9 +75,11 @@ pFlow::sphereDEMSystem::sphereDEMSystem( REPORT(0)<< "\nCreating surface geometry for sphereDEMSystem . . . "<(Control(), Property()); + insertion_ = makeUnique( Control().caseSetup().path()+insertionFile__, particles_(), diff --git a/DEMSystems/sphereDEMSystem/sphereFluidParticles.cpp b/DEMSystems/sphereDEMSystem/sphereFluidParticles.cpp index 386ac859..9b3a44b0 100644 --- a/DEMSystems/sphereDEMSystem/sphereFluidParticles.cpp +++ b/DEMSystems/sphereDEMSystem/sphereFluidParticles.cpp @@ -54,6 +54,13 @@ pFlow::sphereFluidParticles::sphereFluidParticles( ) {} +bool pFlow::sphereFluidParticles::beforeIteration() +{ + sphereParticles::beforeIteration(); + zeroFluidForce_H(); + zeroFluidTorque_H(); + return true; +} bool pFlow::sphereFluidParticles::iterate() diff --git a/DEMSystems/sphereDEMSystem/sphereFluidParticles.hpp b/DEMSystems/sphereDEMSystem/sphereFluidParticles.hpp index 48b73f34..9890dac8 100644 --- a/DEMSystems/sphereDEMSystem/sphereFluidParticles.hpp +++ b/DEMSystems/sphereDEMSystem/sphereFluidParticles.hpp @@ -48,12 +48,24 @@ protected: realx3PointField_HD& fluidTorque_; + void zeroFluidForce_H() + { + fluidForce_.fillHost(zero3); + } + + void zeroFluidTorque_H() + { + fluidTorque_.fillHost(zero3); + } + public: /// construct from systemControl and property sphereFluidParticles(systemControl &control, const property& prop); - + /// before iteration step + bool beforeIteration() override; + /// iterate particles bool iterate() override; diff --git a/solvers/sphereGranFlow/sphereGranFlow.cpp b/solvers/sphereGranFlow/sphereGranFlow.cpp index a4920b86..7b9785cf 100755 --- a/solvers/sphereGranFlow/sphereGranFlow.cpp +++ b/solvers/sphereGranFlow/sphereGranFlow.cpp @@ -65,7 +65,6 @@ if(!cmds.parse(argc, argv)) return 0; do { - Control.timers().start(); if(! sphInsertion.insertParticles( Control.time().currentTime(), @@ -94,8 +93,6 @@ if(!cmds.parse(argc, argv)) return 0; surfGeometry.afterIteration(); - Control.timers().end(); - }while(Control++); REPORT(0)<<"\nEnd of time loop.\n"<(shapeName_.size())); + return insertSphereParticles(shapeName_, indices); } @@ -148,7 +151,7 @@ bool pFlow::sphereParticles::insertSphereParticles( } auto len = names.size(); - + realVector diamVec(len, RESERVE()); realVector massVec(len, RESERVE()); realVector IVec(len, RESERVE()); @@ -160,6 +163,7 @@ bool pFlow::sphereParticles::insertSphereParticles( ForAll(i, names ) { + if (diameterMassInertiaPropId(names[i], d, m, I, pId)) { diamVec.push_back(d); @@ -297,7 +301,6 @@ pFlow::sphereParticles::sphereParticles( fatalExit; } - if(rVelIntegration_->needSetInitialVals()) { @@ -320,6 +323,7 @@ pFlow::sphereParticles::sphereParticles( } + if(!initializeParticles()) { fatalExit; diff --git a/src/phasicFlow/Timer/Timer.cpp b/src/phasicFlow/Timer/Timer.cpp index 9031104e..9a4546e4 100644 --- a/src/phasicFlow/Timer/Timer.cpp +++ b/src/phasicFlow/Timer/Timer.cpp @@ -77,18 +77,24 @@ bool pFlow::Timer::write(iOstream& os, bool subTree)const if(lvl==0) os<smallValue) + { + os<<" execution time (s): total ("<< + tt<<")"; + + if(!master()) + { + os<<", av. ("<< + averageTime()<<")."; + } + } os<timerActive()) total += this->totalTime(); + + for(const auto tmr:timers_) + { + if(tmr -> master()) + { + total += dynamic_cast(tmr)->accTimersTotal(); + } + else if(tmr->timerActive()) + { + total += tmr->totalTime(); + } + } + + return total; +} + bool pFlow::Timers::write(iOstream& os, bool subTree)const { diff --git a/src/phasicFlow/Timer/Timers.hpp b/src/phasicFlow/Timer/Timers.hpp index 087b37ea..cd2630fb 100644 --- a/src/phasicFlow/Timer/Timers.hpp +++ b/src/phasicFlow/Timer/Timers.hpp @@ -18,8 +18,8 @@ Licence: -----------------------------------------------------------------------------*/ -#ifndef __Timers_hpp__ -#define __Timers_hpp__ +#ifndef __Timerss_hpp__ +#define __Timerss_hpp__ #include "Timer.hpp" @@ -30,11 +30,11 @@ namespace pFlow class Timers : - public Timer + public pFlow::Timer { protected: - List timers_; + List timers_; int32 level_ = 0; @@ -93,6 +93,8 @@ public: return true; } + real accTimersTotal()const override; + virtual bool write(iOstream& os, bool subTree = true)const; diff --git a/src/phasicFlow/containers/indexContainer/indexContainer.hpp b/src/phasicFlow/containers/indexContainer/indexContainer.hpp index ddb3ccb8..14e88726 100644 --- a/src/phasicFlow/containers/indexContainer/indexContainer.hpp +++ b/src/phasicFlow/containers/indexContainer/indexContainer.hpp @@ -26,6 +26,7 @@ Licence: #include "KokkosUtilities.hpp" #include "ViewAlgorithms.hpp" + namespace pFlow { @@ -79,8 +80,8 @@ public: size_(end-begin), views_("indexContainer", size_) { - pFlow::fillSequence(views_.d_view, 0, size_, min_); - copy(views_.h_view, views_.d_view); + pFlow::fillSequence(views_.h_view, 0, size_, min_); + copy(views_.d_view, views_.h_view); } diff --git a/src/phasicFlow/repository/Time/timeControl.cpp b/src/phasicFlow/repository/Time/timeControl.cpp index 02e94359..d27aac1a 100644 --- a/src/phasicFlow/repository/Time/timeControl.cpp +++ b/src/phasicFlow/repository/Time/timeControl.cpp @@ -100,6 +100,19 @@ pFlow::timeControl::timeControl( checkForOutputToFile(); } +bool pFlow::timeControl::finalTime()const +{ + if( currentTime_ >= endTime_ ) return true; + if( abs(currentTime_-endTime_) < 0.5*dt_ )return true; + return false; +} + +bool pFlow::timeControl::reachedStopAt()const +{ + if( currentTime_ >= stopAt_ ) return true; + if( abs(currentTime_-stopAt_) < 0.5*dt_ )return true; + return false; +} void pFlow::timeControl::checkForOutputToFile() { @@ -124,10 +137,13 @@ void pFlow::timeControl::checkForOutputToFile() { lastSaved_ = currentTime_; save = true; - } + } + } outputToFile_ = save; + + } bool pFlow::timeControl::timersReportTime()const diff --git a/src/phasicFlow/repository/Time/timeControl.hpp b/src/phasicFlow/repository/Time/timeControl.hpp index 2051f1ac..59d9fc21 100644 --- a/src/phasicFlow/repository/Time/timeControl.hpp +++ b/src/phasicFlow/repository/Time/timeControl.hpp @@ -152,18 +152,9 @@ public: return currentIter_; } - bool finalTime()const - { - if( currentTime_ >= endTime_ ) return true; - if( abs(currentTime_-endTime_) < 0.5*dt_ )return true; - return false; - } - bool reachedStopAt()const - { - if( currentTime_ >= stopAt_ ) return true; - if( abs(currentTime_-stopAt_) < 0.5*dt_ )return true; - return false; - } + bool finalTime()const; + + bool reachedStopAt()const; bool outputToFile()const { diff --git a/src/phasicFlow/repository/systemControl/systemControl.cpp b/src/phasicFlow/repository/systemControl/systemControl.cpp index eabde21a..4cd60260 100644 --- a/src/phasicFlow/repository/systemControl/systemControl.cpp +++ b/src/phasicFlow/repository/systemControl/systemControl.cpp @@ -235,39 +235,43 @@ pFlow::systemControl::systemControl( bool pFlow::systemControl::operator ++(int) { - // skip writing to file for the first iteration - //output<< "time()++"<