kernels (K5): reuse the existing bounce_back_swap instead of a new copy
operators/helpers.cuh already had bounce_back_swap (the uniform steps use it). It moves verbatim, #pragma unroll included, into its own operators/bounce_back_swap.cuh, which helpers.cuh includes; the channel root includes that header and calls it. bounce_back_swap_d2q9 from the previous commit is removed. bounce_back.cuh keeps only the half-way rows helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
33837697da
commit
93e692a40f
4 files changed
+17
-15
No files matched your search
@@ -45,14 +45,6 @@ __device__ inline void apply_wall_bb_d2q9_y_pull(unsigned int y,
|
|||||||
apply_wall_bb_d2q9_rows(y, (unsigned int)(NY - 2), f, fi_in, k);
|
apply_wall_bb_d2q9_rows(y, (unsigned int)(NY - 2), f, fi_in, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Full-way swap of every opposite pair (paired order q, q+1) at a wall node.
|
|
||||||
__device__ __forceinline__ void bounce_back_swap_d2q9(float* f)
|
|
||||||
{
|
|
||||||
for (int q = 1; q < NQ; q += 2) {
|
|
||||||
const float t = f[q]; f[q] = f[q + 1]; f[q + 1] = t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// D2Q9 y-wall free-slip (specular reflection) for pull double-buffer streaming.
|
// D2Q9 y-wall free-slip (specular reflection) for pull double-buffer streaming.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// CelerisLab – operators/bounce_back_swap.cuh
|
||||||
|
// Full-way bounce-back at a wall node: swap every opposite pair (paired
|
||||||
|
// order q, q+1). Needs only NQ; shared by the uniform and blocked steps.
|
||||||
|
#ifndef CELERIS_OPERATORS_BOUNCE_BACK_SWAP_CUH
|
||||||
|
#define CELERIS_OPERATORS_BOUNCE_BACK_SWAP_CUH
|
||||||
|
|
||||||
|
__device__ __forceinline__ void bounce_back_swap(float* f) {
|
||||||
|
#pragma unroll
|
||||||
|
for (int i = 1; i < NQ; i += 2) {
|
||||||
|
float t = f[i]; f[i] = f[i+1]; f[i+1] = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -5,12 +5,7 @@
|
|||||||
#ifndef CELERIS_OPERATORS_HELPERS_CUH
|
#ifndef CELERIS_OPERATORS_HELPERS_CUH
|
||||||
#define CELERIS_OPERATORS_HELPERS_CUH
|
#define CELERIS_OPERATORS_HELPERS_CUH
|
||||||
|
|
||||||
__device__ __forceinline__ void bounce_back_swap(float* f) {
|
#include "bounce_back_swap.cuh"
|
||||||
#pragma unroll
|
|
||||||
for (int i = 1; i < NQ; i += 2) {
|
|
||||||
float t = f[i]; f[i] = f[i+1]; f[i+1] = t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__device__ __forceinline__ void collide_dispatch(
|
__device__ __forceinline__ void collide_dispatch(
|
||||||
float* f, float rho_n,
|
float* f, float rho_n,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
// Root-only blocked counterpart of OneStep's D2Q9/SRT channel closure.
|
// Root-only blocked counterpart of OneStep's D2Q9/SRT channel closure.
|
||||||
// NX/NY are LOCAL strides; all physical boundary decisions use global coordinates.
|
// NX/NY are LOCAL strides; all physical boundary decisions use global coordinates.
|
||||||
#include "../core/cell_kind.cuh"
|
#include "../core/cell_kind.cuh"
|
||||||
|
#include "../operators/bounce_back_swap.cuh"
|
||||||
#include "../boundary/bounce_back.cuh"
|
#include "../boundary/bounce_back.cuh"
|
||||||
#include "../boundary/inlet/common.cuh"
|
#include "../boundary/inlet/common.cuh"
|
||||||
#include "../boundary/inlet/zou_he_local.cuh"
|
#include "../boundary/inlet/zou_he_local.cuh"
|
||||||
@@ -35,7 +36,7 @@ extern "C" __global__ void BlockChannelStep(
|
|||||||
const bool wall = gy == 0 || gy == d_block_channel.ny - 1;
|
const bool wall = gy == 0 || gy == d_block_channel.ny - 1;
|
||||||
const bool outlet = gx == d_block_channel.nx - 1;
|
const bool outlet = gx == d_block_channel.nx - 1;
|
||||||
if (wall) {
|
if (wall) {
|
||||||
bounce_back_swap_d2q9(f); // Wall owns all four corners; ghosts never collide.
|
bounce_back_swap(f); // Wall owns all four corners; ghosts never collide.
|
||||||
} else if (gx == 0) {
|
} else if (gx == 0) {
|
||||||
apply_zou_he_left_velocity_inlet_d2q9(
|
apply_zou_he_left_velocity_inlet_d2q9(
|
||||||
f, inlet_target_u((float)gy, d_block_channel.ny, d_block_channel.velocity), 0.0f);
|
f, inlet_target_u((float)gy, d_block_channel.ny, d_block_channel.velocity), 0.0f);
|
||||||
|
|||||||
Reference in new issue
Block a user