diff --git a/src/gpu/GridGenerator/grid/GridImp.cpp b/src/gpu/GridGenerator/grid/GridImp.cpp index 05c684410166e329ba63bbe3bdbf0c09e3a881ab..e71e135c664dd3415163b870bc6544ea63e7490d 100644 --- a/src/gpu/GridGenerator/grid/GridImp.cpp +++ b/src/gpu/GridGenerator/grid/GridImp.cpp @@ -2109,16 +2109,22 @@ void GridImp::sortFluidNodeIndicesMacroVars() if(this->fluidNodeIndicesAllFeatures.size()>0) { this->fluidNodeIndicesMacroVars.erase( std::remove_if( this->fluidNodeIndicesMacroVars.begin(), this->fluidNodeIndicesMacroVars.end(), - [&](auto x){return binary_search(fluidNodeIndicesAllFeatures.begin(),fluidNodeIndicesAllFeatures.end(),x);} ), - this->fluidNodeIndicesMacroVars.end() - ); + [&](auto x){return binary_search(fluidNodeIndicesAllFeatures.begin(),fluidNodeIndicesAllFeatures.end(),x);} ), + this->fluidNodeIndicesMacroVars.end() ); + } + + // Remove all indices in fluidNodeIndicesBorder from fluidNodeIndicesApplyBodyForce + if(this->fluidNodeIndicesBorder.size()>0) + { + this->fluidNodeIndicesMacroVars.erase( std::remove_if( this->fluidNodeIndicesMacroVars.begin(), this->fluidNodeIndicesMacroVars.end(), + [&](auto x){return binary_search(fluidNodeIndicesBorder.begin(),fluidNodeIndicesBorder.end(),x);} ), + this->fluidNodeIndicesMacroVars.end() ); } // Remove indices of fluidNodeIndicesMacroVars from fluidNodeIndices this->fluidNodeIndices.erase( std::remove_if( this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(), [&](auto x){return binary_search(fluidNodeIndicesMacroVars.begin(),fluidNodeIndicesMacroVars.end(),x);} ), - this->fluidNodeIndices.end() - ); + this->fluidNodeIndices.end() ); } } @@ -2130,20 +2136,26 @@ void GridImp::sortFluidNodeIndicesApplyBodyForce() // Remove duplicates this->fluidNodeIndicesApplyBodyForce.erase( unique( this->fluidNodeIndicesApplyBodyForce.begin(), this->fluidNodeIndicesApplyBodyForce.end() ), this->fluidNodeIndicesApplyBodyForce.end() ); - // Remove indices of fluidNodeIndicesAllFeatures from fluidNodeIndicesMacroVars + // Remove indices of fluidNodeIndicesAllFeatures from fluidNodeIndicesApplyBodyForce if(this->fluidNodeIndicesAllFeatures.size()>0) { - this->fluidNodeIndicesApplyBodyForce.erase( std::remove_if( this->fluidNodeIndicesApplyBodyForce.begin(), this->fluidNodeIndicesApplyBodyForce.end(), + this->fluidNodeIndicesApplyBodyForce.erase( std::remove_if( this->fluidNodeIndicesApplyBodyForce.begin(), this->fluidNodeIndicesApplyBodyForce.end(), [&](auto x){return binary_search(fluidNodeIndicesAllFeatures.begin(),fluidNodeIndicesAllFeatures.end(),x);} ), - this->fluidNodeIndicesApplyBodyForce.end() - ); + this->fluidNodeIndicesApplyBodyForce.end() ); + } + + // Remove all indices in fluidNodeIndicesBorder from fluidNodeIndicesApplyBodyForce + if(this->fluidNodeIndicesBorder.size()>0) + { + this->fluidNodeIndicesApplyBodyForce.erase( std::remove_if( this->fluidNodeIndicesApplyBodyForce.begin(), this->fluidNodeIndicesApplyBodyForce.end(), + [&](auto x){return binary_search(fluidNodeIndicesBorder.begin(),fluidNodeIndicesBorder.end(),x);} ), + this->fluidNodeIndicesApplyBodyForce.end() ); } // Remove indices of fluidNodeIndicesMacroVars from fluidNodeIndices this->fluidNodeIndices.erase( std::remove_if( this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(), - [&](auto x){return binary_search(fluidNodeIndicesApplyBodyForce.begin(),fluidNodeIndicesApplyBodyForce.end(),x);} ), - this->fluidNodeIndices.end() - ); + [&](auto x){return binary_search(fluidNodeIndicesApplyBodyForce.begin(),fluidNodeIndicesApplyBodyForce.end(),x);} ), + this->fluidNodeIndices.end() ); } } @@ -2154,11 +2166,19 @@ void GridImp::sortFluidNodeIndicesAllFeatures() sort(this->fluidNodeIndicesAllFeatures.begin(), this->fluidNodeIndicesAllFeatures.end()); // Remove duplicates this->fluidNodeIndicesAllFeatures.erase( unique( this->fluidNodeIndicesAllFeatures.begin(), this->fluidNodeIndicesAllFeatures.end() ), this->fluidNodeIndicesAllFeatures.end() ); - // Remove indices of fluidNodeIndicesMacroVars from fluidNodeIndices + + // Remove all indices in fluidNodeIndicesBorder from fluidNodeIndicesAllFeatures + if(this->fluidNodeIndicesBorder.size()>0) + { + this->fluidNodeIndicesAllFeatures.erase( std::remove_if( this->fluidNodeIndicesAllFeatures.begin(), this->fluidNodeIndicesAllFeatures.end(), + [&](auto x){return binary_search(fluidNodeIndicesBorder.begin(),fluidNodeIndicesBorder.end(),x);} ), + this->fluidNodeIndicesAllFeatures.end() ); + } + + // Remove indices of fluidNodeIndicesAllFeatures from fluidNodeIndices this->fluidNodeIndices.erase( std::remove_if( this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(), [&](auto x){return binary_search(fluidNodeIndicesAllFeatures.begin(),fluidNodeIndicesAllFeatures.end(),x);} ), - this->fluidNodeIndices.end() - ); + this->fluidNodeIndices.end() ); } } diff --git a/src/gpu/VirtualFluids_GPU/GPU/StressBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/StressBCs27.cu index 2d65c297496ae4a5f2bae4b59238067a6dcb6f47..3b141e3f89748a4be7bc97d5794420b65bdf4fd2 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/StressBCs27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/StressBCs27.cu @@ -106,7 +106,7 @@ __host__ __device__ __forceinline__ void iMEM(uint k, uint kN, real _vz_w = vz_w_inst-vDotN_w*wallNormalZ; //Compute wall shear stress tau_w via MOST - real z = (real)samplingOffset[k] + 0.5; //assuming q=0.5, could be replaced by wall distance via wall normal + real z = (real)samplingOffset[k] + q; //assuming q=0.5, could be replaced by wall distance via wall normal real kappa = 0.4; real u_star = vMag_el*kappa/(log(z/z0[k])); if(hasWallModelMonitor) u_star_monitor[k] = u_star; @@ -136,6 +136,7 @@ __host__ __device__ __forceinline__ void iMEM(uint k, uint kN, wallVelocityZ = clipVz > -clipVz? min(clipVz, max(-clipVz, -3.0*F_z*forceFactor)): max(clipVz, min(-clipVz, -3.0*F_z*forceFactor)); } + ////////////////////////////////////////////////////////////////////////////// __global__ void QStressDeviceComp27(real* DD, int* k_Q,