URI: 
       tfix bounce-back BC issues during streaming - lbm-d3q19 - 3D lattice-Boltzmann code to approximate Navier-Stokes incompressible flow
  HTML git clone git://src.adamsgaard.dk/lbm-d3q19
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
   DIR commit fc71734e79e62bc8bb6d94c90a2dc9f8e28b892d
   DIR parent cf5511226d5583fc4d83435119d9f0f5c1915c52
  HTML Author: Anders Damsgaard Christensen <adc@geo.au.dk>
       Date:   Thu, 20 Oct 2016 14:55:21 -0700
       
       fix bounce-back BC issues during streaming
       
       Diffstat:
         M Makefile                            |       4 +++-
         M lbm.c                               |      11 ++++++-----
       
       2 files changed, 9 insertions(+), 6 deletions(-)
       ---
   DIR diff --git a/Makefile b/Makefile
       t@@ -2,13 +2,15 @@ CFLAGS=-g -Wall -pg -O2 -fopenmp
        LDLIBS=-lm
        BIN=lbm
        
       +.PHONY: default plots data profile clean
       +
        default: plots
        
        plots: data
                # Plotting data
                @cd out && for f in *.txt; do gnuplot -e "matrixfile='$$f'" plotmatrix.gp; done
        
       -data: clean $(BIN)
       +data: $(BIN)
                # Running program
                @./$(BIN)
        
   DIR diff --git a/lbm.c b/lbm.c
       t@@ -369,16 +369,16 @@ void stream(Float* f, Float* f_new)
                            f_new[idxi(  x,  y,  z,  5)]
                                = fmax(0.0, f[idxi(x, y, z, 6)]);
        
       -                
       +
                        // Edge 7 (+x,+y): Bounce back
                        if (x < nx-1 && y < ny-1)
                            f_new[idxi(x+1,y+1,  z,  7)]
                                = fmax(0.0, f[idxi(x, y, z, 7)]);
                        else if (x < nx-1)
       -                    f_new[idxi(x+1,  y,  z,  9)]
       +                    f_new[idxi(x+1,  y,  z, 10)]
                                = fmax(0.0, f[idxi(x, y, z, 7)]);
                        else if (y < ny-1)
       -                    f_new[idxi(  x,y+1,  z, 10)]
       +                    f_new[idxi(  x,y+1,  z,  9)]
                                = fmax(0.0, f[idxi(x, y, z, 7)]);
                        else
                            f_new[idxi(  x,  y,  z,  8)]
       t@@ -417,10 +417,10 @@ void stream(Float* f, Float* f_new)
                            f_new[idxi(x+1,y-1,  z, 10)]
                                = fmax(0.0, f[idxi(x, y, z, 10)]);
                        else if (x < nx-1)
       -                    f_new[idxi(x+1,  y,  z,  8)]
       +                    f_new[idxi(x+1,  y,  z,  7)]
                                = fmax(0.0, f[idxi(x, y, z, 10)]);
                        else if (y > 0)
       -                    f_new[idxi(  x,y-1,  z,  7)]
       +                    f_new[idxi(  x,y-1,  z,  8)]
                                = fmax(0.0, f[idxi(x, y, z, 10)]);
                        else
                            f_new[idxi(  x,  y,  z,  9)]
       t@@ -537,6 +537,7 @@ void stream(Float* f, Float* f_new)
                        else
                            f_new[idxi(  x,  y,  z, 17)]
                                = fmax(0.0, f[idxi(x, y, z, 18)]);
       +
                    }
                }
            }