/*------------------------------- 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 "multiRotatingAxisMotion.hpp" void pFlow::multiRotatingAxisMotion::impl_setTime ( uint32 iter, real t, real dt )const { auto motion = motionComponents_.deviceViewAll(); Kokkos::parallel_for( "multiRotatingAxisMotion::impl_setTime", deviceRPolicyStatic(0, numComponents_), LAMBDA_D(uint32 i){ motion[i].setTime(t); }); Kokkos::fence(); } bool pFlow::multiRotatingAxisMotion::impl_move(uint32 iter, real t , real dt ) const { auto motion = motionComponents_.deviceViewAll(); Kokkos::parallel_for( "multiRotatingAxisMotion::impl_move", deviceRPolicyStatic(0, numComponents_), LAMBDA_D(uint32 i){ motion[i].move(dt); }); Kokkos::fence(); return true; } bool pFlow::multiRotatingAxisMotion::impl_readDictionary(const dictionary &dict) { auto modelName = dict.getVal("motionModel"); if(modelName != getTypeName()) { fatalErrorInFunction<< " motionModel should be "<< Yellow_Text(getTypeName())<< ", but found "<< Yellow_Text(modelName)<(axDict); axPtr) { rotationAxisNames.push_back( axDict.getValOrSet("rotationAxis", "none")); } else { fatalErrorInFunction<< "could not read rotating axis from "<< axDict.globalName()<; std::vector numRotAxis; for(size_t i=0; i< compNames.size(); i++) { word rotAxis = rotationAxisNames[i]; int32 n=0; while(rotAxis != "none") { n++; if(int32 iAxis = compNames.findi(rotAxis) ; iAxis != -1) { rotAxis = rotationAxisNames[iAxis]; }else { fatalErrorInFunction<< "rotation axis name "<< rotAxis << "is does not exist!"< b.first; }; std::sort(numRotAxis.begin(), numRotAxis.end(), compareFunc); Vector sortedIndex; componentNames_.clear(); output< components("Read::modelComponent", compNames.size()+1, 0, RESERVE()); for(auto& compName: componentNames_) { if(compName != "none") { auto& compDict = motionInfo.subDict(compName); components.emplace_back( motionComponents_.data(), componentNames_, compDict); } else { components.emplace_back(impl_noneComponent()); } } motionComponents_.assign(components); return true; } bool pFlow::multiRotatingAxisMotion::impl_writeDictionary ( dictionary& dict )const { word modelName = "multiRotatingAxis"; dict.add("motionModel", modelName ); auto modelDictName = modelName+"Info"; auto& motionInfo = dict.subDictOrCreate(modelDictName); auto hostComponents = motionComponents_.hostView(); ForAll(i, motionComponents_) { auto& axDict = motionInfo.subDictOrCreate(componentNames_[i]); if( !hostComponents[i].write(axDict, componentNames_)) { fatalErrorInFunction<< " error in writing axis "<< componentNames_[i] << " to dicrionary " << motionInfo.globalName()<