diff --git a/src/GridGenerator/grid/Field.cu b/src/GridGenerator/grid/Field.cu index b54686803b59be6e5fd26c1e203a6cd8b10f7df7..27914835602a3c92a1d5a5c04cef730d11fdb0de 100644 --- a/src/GridGenerator/grid/Field.cu +++ b/src/GridGenerator/grid/Field.cu @@ -91,6 +91,11 @@ HOSTDEVICE bool Field::isStopperOverlapGrid(uint index) const return field[index] == STOPPER_OVERLAP_GRID; } +HOSTDEVICE bool Field::isStopper(uint index) const +{ + return isStopperEndOfGrid(index) || isStopperOverlapGrid(index); +} + HOSTDEVICE bool Field::isQ(uint index) const { return field[index] == Q; diff --git a/src/GridGenerator/grid/Field.h b/src/GridGenerator/grid/Field.h index c79b29fe1e6d7438699b94b0903cb195d9d7c5d6..3b56e1b4deaf89d8b5e2685a7f9f056160403ca5 100644 --- a/src/GridGenerator/grid/Field.h +++ b/src/GridGenerator/grid/Field.h @@ -28,6 +28,7 @@ public: HOSTDEVICE bool isInvalid(uint index) const; HOSTDEVICE bool isStopperEndOfGrid(uint index) const; HOSTDEVICE bool isStopperOverlapGrid(uint index) const; + HOSTDEVICE bool isStopper(uint index) const; HOSTDEVICE bool isOutOfGrid(uint index) const; HOSTDEVICE void setFieldEntry(uint index, char val); diff --git a/src/GridGenerator/grid/GridImp.cu b/src/GridGenerator/grid/GridImp.cu index ebf9d9c20270521ddd136fec95a9108605c58cd9..022ac9a121daca28b989531ed12bd768c511769a 100644 --- a/src/GridGenerator/grid/GridImp.cu +++ b/src/GridGenerator/grid/GridImp.cu @@ -309,7 +309,7 @@ HOSTDEVICE void GridImp::setNeighborIndices(uint index) neighborIndexY[index] = -1; neighborIndexZ[index] = -1; - if (this->field.isStopperEndOfGrid(index) || this->field.isStopperOverlapGrid(index)) + if (this->field.isStopper(index)) { this->setStopperNeighborCoords(index); return; @@ -336,13 +336,13 @@ HOSTDEVICE void GridImp::setStopperNeighborCoords(uint index) real x, y, z; this->transIndexToCoords(index, x, y, z); - if (CudaMath::lessEqual(x + delta, endX) && (this->field.isStopperEndOfGrid(this->transCoordToIndex(x + delta, y, z)) || this->field.isFluid(this->transCoordToIndex(x + delta, y, z)))) + if (CudaMath::lessEqual(x + delta, endX) && (this->field.isStopper(this->transCoordToIndex(x + delta, y, z)) || this->field.isFluid(this->transCoordToIndex(x + delta, y, z)))) neighborIndexX[index] = getSparseIndex(x + delta, y, z); - if (CudaMath::lessEqual(y + delta, endY) && (this->field.isStopperEndOfGrid(this->transCoordToIndex(x, y + delta, z)) || this->field.isFluid(this->transCoordToIndex(x, y + delta, z)))) + if (CudaMath::lessEqual(y + delta, endY) && (this->field.isStopper(this->transCoordToIndex(x, y + delta, z)) || this->field.isFluid(this->transCoordToIndex(x, y + delta, z)))) neighborIndexY[index] = getSparseIndex(x, y + delta, z); - if (CudaMath::lessEqual(z + delta, endZ) && (this->field.isStopperEndOfGrid(this->transCoordToIndex(x, y, z + delta)) || this->field.isFluid(this->transCoordToIndex(x, y, z + delta)))) + if (CudaMath::lessEqual(z + delta, endZ) && (this->field.isStopper(this->transCoordToIndex(x, y, z + delta)) || this->field.isFluid(this->transCoordToIndex(x, y, z + delta)))) neighborIndexZ[index] = getSparseIndex(x, y, z + delta); } @@ -374,7 +374,7 @@ HOSTDEVICE real GridImp::getFirstFluidNode(real coords[3], int direction, real s { coords[direction] = startCoord; int index = this->transCoordToIndex(coords[0], coords[1], coords[2]); - while (field.isOutOfGrid(index)) + while (!field.isFluid(index)) { coords[direction] += delta; index = this->transCoordToIndex(coords[0], coords[1], coords[2]); diff --git a/src/GridGenerator/grid/GridInterface.cu b/src/GridGenerator/grid/GridInterface.cu index 1953cf1a13d5bfd2cf9330fa585d11d276c8f7c1..62be00bcd691b0a5fe87c25c9e723aaad4eb37ef 100644 --- a/src/GridGenerator/grid/GridInterface.cu +++ b/src/GridGenerator/grid/GridInterface.cu @@ -32,7 +32,6 @@ void GridInterface::findInterfaceCF(const uint& indexOnCoarseGrid, GridImp* coar real x, y, z; coarseGrid->transIndexToCoords(indexOnCoarseGrid, x, y, z); - for(const auto dir : coarseGrid->distribution) { const bool isFineGridNeighborFluid = isNeighborFineFluid(x + dir[0] * coarseGrid->getDelta(), y + dir[1] * coarseGrid->getDelta(), z + dir[2] * coarseGrid->getDelta(), coarseGrid, fineGrid); diff --git a/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp b/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp index 28357dbdf3add9110138870f13ad30d78625c7c3..95d08416d835a9e9b50e62ca16a0902ea8b2fb0b 100644 --- a/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp +++ b/src/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp @@ -177,7 +177,7 @@ void SimulationFileWriter::writeCoordsNeighborsGeo(SPtr<GridBuilder> builder, in if (grid->getSparseIndex(index) == -1) return; - int type = grid->getFieldEntry(index) == SOLID ? 16 : 19; + int type = grid->getFieldEntry(index) == FLUID ? 19 : 16; real x, y, z; grid->transIndexToCoords(index, x, y, z); diff --git a/src/VirtualFluids_GPU/LBM/Simulation.cpp b/src/VirtualFluids_GPU/LBM/Simulation.cpp index 8e894308ab1a4fad838f3b45da7208ed85390ee4..e303f74dd16870ea5d85ea959b6a39eb070abb5e 100644 --- a/src/VirtualFluids_GPU/LBM/Simulation.cpp +++ b/src/VirtualFluids_GPU/LBM/Simulation.cpp @@ -1684,7 +1684,7 @@ void Simulation::run() //para->getParD(0)->offFC); // getLastCudaError("ScaleFC_Fix_comp_27 execution failed"); //////////////////////////////////////////////////////////////////////////// - /*ScaleFC_RhoSq_comp_27(para->getParD(0)->d0SP.f[0], para->getParD(1)->d0SP.f[0], + ScaleFC_RhoSq_comp_27(para->getParD(0)->d0SP.f[0], para->getParD(1)->d0SP.f[0], para->getParD(0)->neighborX_SP, para->getParD(0)->neighborY_SP, para->getParD(0)->neighborZ_SP, para->getParD(1)->neighborX_SP, para->getParD(1)->neighborY_SP, para->getParD(1)->neighborZ_SP, para->getParD(0)->size_Mat_SP, para->getParD(1)->size_Mat_SP, para->getParD(0)->evenOrOdd, @@ -1693,7 +1693,7 @@ void Simulation::run() para->getParD(0)->vis, para->getParD(0)->nx, para->getParD(0)->ny, para->getParD(1)->nx, para->getParD(1)->ny, para->getParD(0)->numberofthreads, para->getParD(0)->offFC); - getLastCudaError("ScaleFC_RhoSq_comp_27 execution failed");*/ + getLastCudaError("ScaleFC_RhoSq_comp_27 execution failed"); ////////////////////////////////////////////////////////////////////////// // ScaleFC_RhoSq_3rdMom_comp_27(para->getParD(0)->d0SP.f[0], para->getParD(1)->d0SP.f[0], //para->getParD(0)->neighborX_SP, para->getParD(0)->neighborY_SP, para->getParD(0)->neighborZ_SP, @@ -1754,16 +1754,16 @@ void Simulation::run() // para->getParD(0)->offCF); //getLastCudaError("ScaleCF_0817_comp_27 execution failed"); //////////////////////////////////////////////////////////////////////// - // ScaleCF_Fix_comp_27(para->getParD(0)->d0SP.f[0], para->getParD(1)->d0SP.f[0], - //para->getParD(0)->neighborX_SP, para->getParD(0)->neighborY_SP, para->getParD(0)->neighborZ_SP, - //para->getParD(1)->neighborX_SP, para->getParD(1)->neighborY_SP, para->getParD(1)->neighborZ_SP, - //para->getParD(0)->size_Mat_SP, para->getParD(1)->size_Mat_SP, para->getParD(0)->evenOrOdd, - //para->getParD(0)->intCF.ICellCFC, para->getParD(0)->intCF.ICellCFF, - //para->getParD(0)->K_CF, para->getParD(0)->omega, para->getParD(1)->omega, - //para->getParD(0)->vis, para->getParD(0)->nx, para->getParD(0)->ny, - //para->getParD(1)->nx, para->getParD(1)->ny, para->getParD(0)->numberofthreads, - //para->getParD(0)->offCF); - // getLastCudaError("ScaleCF_Fix_comp_27 execution failed"); + ScaleCF_Fix_comp_27(para->getParD(0)->d0SP.f[0], para->getParD(1)->d0SP.f[0], + para->getParD(0)->neighborX_SP, para->getParD(0)->neighborY_SP, para->getParD(0)->neighborZ_SP, + para->getParD(1)->neighborX_SP, para->getParD(1)->neighborY_SP, para->getParD(1)->neighborZ_SP, + para->getParD(0)->size_Mat_SP, para->getParD(1)->size_Mat_SP, para->getParD(0)->evenOrOdd, + para->getParD(0)->intCF.ICellCFC, para->getParD(0)->intCF.ICellCFF, + para->getParD(0)->K_CF, para->getParD(0)->omega, para->getParD(1)->omega, + para->getParD(0)->vis, para->getParD(0)->nx, para->getParD(0)->ny, + para->getParD(1)->nx, para->getParD(1)->ny, para->getParD(0)->numberofthreads, + para->getParD(0)->offCF); + getLastCudaError("ScaleCF_Fix_comp_27 execution failed"); //////////////////////////////////////////////////////////////////////// //ScaleCF_RhoSq_comp_27(para->getParD(0)->d0SP.f[0], para->getParD(1)->d0SP.f[0], // para->getParD(0)->neighborX_SP, para->getParD(0)->neighborY_SP, para->getParD(0)->neighborZ_SP, diff --git a/targets/apps/HULC/main.cpp b/targets/apps/HULC/main.cpp index 499774200f7b9a34ddbc966c07d361e0b7bc2017..85bf0f37ff211ca53842ac14bb053156a288a290 100644 --- a/targets/apps/HULC/main.cpp +++ b/targets/apps/HULC/main.cpp @@ -266,7 +266,7 @@ void multipleLevel(const std::string& configPath) //gridBuilder->writeGridToVTK("D:/GRIDGENERATION/gridTestCuboid_level_0", 0); //gridBuilder->writeGridToVTK("D:/GRIDGENERATION/gridTestCuboid_level_1", 1); - //SimulationFileWriter::write("D:/GRIDGENERATION/couplingVF/primitive_sphere/simu/", gridBuilder, FILEFORMAT::ASCII); + //SimulationFileWriter::write("D:/GRIDGENERATION/couplingVF/test/simu/", gridBuilder, FILEFORMAT::ASCII); //const uint level = 2; //gridBuilder->addFineGrid(0.0, 0.0, 0.0, 10.0, 10.0, 10.0, level);