diff --git a/src/main/c/src/fluid/sim/grid2/utilities.c b/src/main/c/src/fluid/sim/grid2/utilities.c index 18dac8d5..1305bb0f 100644 --- a/src/main/c/src/fluid/sim/grid2/utilities.c +++ b/src/main/c/src/fluid/sim/grid2/utilities.c @@ -69,16 +69,16 @@ void fluid_grid2_set_bounds_reflection( //x-direction boundary planes if(vector_dir==BOUND_SET_VECTOR_DIFFUSE_PHI_U || vector_dir==BOUND_SET_VECTOR_U){ - // if(boundsArr[IX(0,x,y)] > 0){ + if(boundsArr[IX(0,x,y)] > 0){ target[IX(0,x,y)] = -target[IX(1,x,y)]; - // } else { - // target[IX(0,x,y)] = target[IX(1,x,y)]; - // } - // if(boundsArr[IX(DIM-1,x,y)] > 0){ + } else { + target[IX(0,x,y)] = 0; + } + if(boundsArr[IX(DIM-1,x,y)] > 0){ target[IX(DIM-1,x,y)] = -target[IX(DIM-2,x,y)]; - // } else { - // target[IX(DIM-1,x,y)] = target[IX(DIM-2,x,y)]; - // } + } else { + target[IX(DIM-1,x,y)] = 0; + } } else { target[IX(0,x,y)] = target[IX(1,x,y)]; target[IX(DIM-1,x,y)] = target[IX(DIM-2,x,y)]; @@ -86,16 +86,16 @@ void fluid_grid2_set_bounds_reflection( //y-direction boundary planes if(vector_dir==BOUND_SET_VECTOR_DIFFUSE_PHI_V || vector_dir==BOUND_SET_VECTOR_V){ - // if(boundsArr[IX(x,0,y)] > 0){ + if(boundsArr[IX(x,0,y)] > 0){ target[IX(x,0,y)] = -target[IX(x,1,y)]; - // } else { - // target[IX(x,0,y)] = target[IX(x,1,y)]; - // } - // if(boundsArr[IX(x,DIM-1,y)] > 0){ + } else { + target[IX(x,0,y)] = 0; + } + if(boundsArr[IX(x,DIM-1,y)] > 0){ target[IX(x,DIM-1,y)] = -target[IX(x,DIM-2,y)]; - // } else { - // target[IX(x,DIM-1,y)] = target[IX(x,DIM-2,y)]; - // } + } else { + target[IX(x,DIM-1,y)] = 0; + } } else { target[IX(x,0,y)] = target[IX(x,1,y)]; target[IX(x,DIM-1,y)] = target[IX(x,DIM-2,y)]; @@ -103,16 +103,16 @@ void fluid_grid2_set_bounds_reflection( //z-direction boundary planes if(vector_dir==BOUND_SET_VECTOR_DIFFUSE_PHI_W || vector_dir==BOUND_SET_VECTOR_W){ - // if(boundsArr[IX(x,y,0)] > 0){ + if(boundsArr[IX(x,y,0)] > 0){ target[IX(x,y,0)] = -target[IX(x,y,1)]; - // } else { - // target[IX(x,y,0)] = target[IX(x,y,1)]; - // } - // if(boundsArr[IX(x,y,DIM-1)] > 0){ + } else { + target[IX(x,y,0)] = 0; + } + if(boundsArr[IX(x,y,DIM-1)] > 0){ target[IX(x,y,DIM-1)] = -target[IX(x,y,DIM-2)]; - // } else { - // target[IX(x,y,DIM-1)] = -target[IX(x,y,DIM-2)]; - // } + } else { + target[IX(x,y,DIM-1)] = 0; + } } else { target[IX(x,y,0)] = target[IX(x,y,1)]; target[IX(x,y,DIM-1)] = target[IX(x,y,DIM-2)];