diff --git a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp index 00f82714c9d6b6b932ea3fca448a989854b0879d..038aa59250ecc0c0cc373e5db8469e554cc4bf67 100644 --- a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp +++ b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp @@ -117,7 +117,7 @@ void multipleLevel(const std::string& configPath) std::string bivalveType = "MUSSEL"; // "MUSSEL" "OYSTER" std::string gridPath(gridPathParent + bivalveType); // only for GridGenerator, for GridReader the gridPath needs to be set in the config file - real dxGrid = (real)0.5; + real dxGrid = (real)2.0; real vxLB = (real)0.051; // LB units real Re = (real)300.0; real viscosityLB = (vxLB * dxGrid) / Re; @@ -132,8 +132,8 @@ void multipleLevel(const std::string& configPath) *logging::out << logging::Logger::INFO_HIGH << "velocity real [m/s] = " << vxLB * para->getVelocityRatio()<< " \n"; *logging::out << logging::Logger::INFO_HIGH << "viscosity real [m^2/s] = " << viscosityLB * para->getViscosityRatio() << "\n"; - para->setTOut(10000); - para->setTEnd(10000); + para->setTOut(10); + para->setTEnd(10); para->setCalcDragLift(false); para->setUseWale(false); diff --git a/src/gpu/GridGenerator/grid/Grid.h b/src/gpu/GridGenerator/grid/Grid.h index d4621562a56e33e632d8e2a9c92dd40fa49f3bbf..460b7a171ca46d83a0e48e33e5accb870d4999c5 100644 --- a/src/gpu/GridGenerator/grid/Grid.h +++ b/src/gpu/GridGenerator/grid/Grid.h @@ -146,6 +146,8 @@ public: virtual uint getNumberOfFluidNodes() const = 0; virtual void getFluidNodeIndices(uint *fluidNodeIndices) const = 0; + virtual void findFluidNodeIndicesBorder() = 0; + virtual uint getNumberOfFluidNodesBorder() const = 0; virtual void getFluidNodeIndicesBorder(uint *fluidNodeIndicesBorder) const = 0; }; diff --git a/src/gpu/GridGenerator/grid/GridImp.cu b/src/gpu/GridGenerator/grid/GridImp.cu index 4ec62b88c851cbe44e6e5f68ea79cdceeb0f6ae3..f25a88f2bc90b47f8ac0c0443de1b73f506514c6 100644 --- a/src/gpu/GridGenerator/grid/GridImp.cu +++ b/src/gpu/GridGenerator/grid/GridImp.cu @@ -5,6 +5,7 @@ #include <iostream> #include <omp.h> #include <sstream> +# include <algorithm> #include "global.h" @@ -860,7 +861,9 @@ CUDA_HOST void GridImp::updateSparseIndices() CUDA_HOST void GridImp::findFluidNodeIndices(bool splitDomain) { + findFluidNodeIndicesBorder(); this->fluidNodeIndices.clear(); + this->fluidNodeIndicesBorder.clear(); for (uint index = 0; index < this->size; index++) { int sparseIndex = this->getSparseIndex(index); if (sparseIndex == -1) @@ -869,6 +872,10 @@ CUDA_HOST void GridImp::findFluidNodeIndices(bool splitDomain) // + 1 for numbering shift between GridGenerator and VF_GPU // When splitDomain: push indices of fluid nodes in bulk to "fluidNodeIndices" and push indices of special fluid nodes (not in bulk) to fluidNodeIndicesBorder // When not splitDomain: push indices of all fluid nodes to "fluidNodeIndices" + //if (this->field.isFluid(index)) { + // this->fluidNodeIndices.push_back((uint)sparseIndex + 1); + //} + if (this->field.isFluid(index)) { if (splitDomain) //if (this->field.isFluidNodeOfSpecialInterest(index)) @@ -880,6 +887,34 @@ CUDA_HOST void GridImp::findFluidNodeIndices(bool splitDomain) this->fluidNodeIndices.push_back((uint)sparseIndex + 1); } } + std::sort(this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end()); + printf("old size: %i \n", this->fluidNodeIndicesBorder.size()); + printf("old: %i \n", this->fluidNodeIndicesBorder.back()); +} + +void GridImp::findFluidNodeIndicesBorder() { + this->fluidNodeIndicesBorder.clear(); + + size_t newSize = 0; + for (CommunicationIndices& ci : this->communicationIndices) + newSize += ci.sendIndices.size(); + this->fluidNodeIndicesBorder.reserve(newSize); + + for (CommunicationIndices& ci : this->communicationIndices) + std::copy(ci.sendIndices.begin(), ci.sendIndices.end(), std::back_inserter(this->fluidNodeIndicesBorder)); + printf("new size 1: %i \n", this->fluidNodeIndicesBorder.size()); + + // remove duplicate elements + std::sort(this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end()); + this->fluidNodeIndicesBorder.erase( + std::unique(this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end()), + this->fluidNodeIndicesBorder.end()); + + // + 1 for numbering shift between GridGenerator and VF_GPU + printf("new size 2: %i \n", this->fluidNodeIndicesBorder.size()); + printf("new: %i \n", this->fluidNodeIndicesBorder.back()); + for (size_t i = 0; i < this->fluidNodeIndicesBorder.size(); i++) + this->fluidNodeIndicesBorder[i] = this->getSparseIndex(this->fluidNodeIndicesBorder[i])+1; } HOSTDEVICE void GridImp::setNeighborIndices(uint index) diff --git a/src/gpu/GridGenerator/grid/GridImp.h b/src/gpu/GridGenerator/grid/GridImp.h index fb7ab02a0e59a2677265732f5653f9b1fd1a52c3..1e74e9521f15967c05d376d564adcc2f39be441c 100644 --- a/src/gpu/GridGenerator/grid/GridImp.h +++ b/src/gpu/GridGenerator/grid/GridImp.h @@ -317,6 +317,7 @@ public: void repairCommunicationInices(int direction) override; void findFluidNodeIndices(bool splitDomain) override; + void findFluidNodeIndicesBorder() override; uint getNumberOfFluidNodes() const override; CUDA_HOST void getFluidNodeIndices(uint *fluidNodeIndices) const override;