tbegin implementation of non-periodic x/y boundaries - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
 (HTM) git clone git://src.adamsgaard.dk/sphere
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit e53e2d38e92b46fc474ba331ad568026b3ee1cd2
 (DIR) parent bf598ca922f970507d22b8e7af93fc08c32b5299
 (HTM) Author: Anders Damsgaard Christensen <adc@geo.au.dk>
       Date:   Thu, 11 Aug 2016 10:56:21 -0700
       
       begin implementation of non-periodic x/y boundaries
       
       Diffstat:
         M python/sphere.py                    |      15 ++++++++++++---
         M src/darcy.cuh                       |      34 +++++++++++++++++++++++--------
         M src/version.h                       |       2 +-
       
       3 files changed, 39 insertions(+), 12 deletions(-)
       ---
 (DIR) diff --git a/python/sphere.py b/python/sphere.py
       t@@ -23,8 +23,8 @@ else:
        numpy.seterr(all='warn', over='raise')
        
        # Sphere version number. This field should correspond to the value in
       -# `../src/constants.h`.
       -VERSION = 2.11
       +# `../src/version.h`.
       +VERSION = 2.12
        
        # Transparency on plot legends
        legend_alpha = 0.5
       t@@ -330,7 +330,7 @@ class sim:
                    self.p_mod_phi = numpy.zeros(1, dtype=numpy.float64) # Shift [rad]
        
                    # Boundary conditions at the top and bottom of the fluid grid
       -            # 0: Dirichlet
       +            # 0: Dirichlet (default)
                    # 1: Neumann free slip
                    # 2: Neumann no slip
                    # 3: Periodic
       t@@ -345,6 +345,15 @@ class sim:
                    self.bc_bot_flux = numpy.zeros(1, dtype=numpy.float64)
                    self.bc_top_flux = numpy.zeros(1, dtype=numpy.float64)
        
       +            # Boundary conditions at the top and bottom of the fluid grid
       +            # 0: Dirichlet
       +            # 1: Neumann
       +            # 2: Periodic (default)
       +            # 3: Constant flux (Darcy solver only)
       +            self.bc_xn = numpy.zeros(1, dtype=numpy.int32)*2  # Neg. x boundary
       +            self.bc_xp = numpy.zeros(1, dtype=numpy.int32)*2  # Pos. x boundary
       +            self.bc_yn = numpy.zeros(1, dtype=numpy.int32)*2  # Neg. y boundary
       +            self.bc_yp = numpy.zeros(1, dtype=numpy.int32)*2  # Pos. y boundary
        
                    ## Solver parameters
        
 (DIR) diff --git a/src/darcy.cuh b/src/darcy.cuh
       t@@ -223,16 +223,34 @@ __global__ void setDarcyGhostNodes(
                const T val = dev_scalarfield[d_idx(x,y,z)];
        
                // x
       -        if (x == 0)
       -            dev_scalarfield[idx(nx,y,z)] = val;
       -        if (x == nx-1)
       -            dev_scalarfield[idx(-1,y,z)] = val;
       +        if (x == 0 && bc_xn == 0)
       +            dev_scalarfield[idx(-1,y,z)] = val;     // Dirichlet
       +        if (x == 1 && bc_xn == 1)
       +            dev_scalarfield[idx(-1,y,z)] = val;     // Neumann
       +        if (x == 0 && bc_xn == 2)
       +            dev_scalarfield[idx(nx,y,z)] = val;     // Periodic -y
       +
       +        if (x == nx-1 && bc_xp == 0)
       +            dev_scalarfield[idx(nx,y,z)] = val;     // Dirichlet
       +        if (x == nx-2 && bc_xp == 1)
       +            dev_scalarfield[idx(nx,y,z)] = val;     // Neumann
       +        if (x == nx-1 && bc_xp == 2)
       +            dev_scalarfield[idx(-1,y,z)] = val;     // Periodic +x
        
                // y
       -        if (y == 0)
       -            dev_scalarfield[idx(x,ny,z)] = val;
       -        if (y == ny-1)
       -            dev_scalarfield[idx(x,-1,z)] = val;
       +        if (y == 0 && bc_yn == 0)
       +            dev_scalarfield[idx(x,-1,z)] = val;     // Dirichlet
       +        if (y == 1 && bc_yn == 1)
       +            dev_scalarfield[idx(x,-1,z)] = val;     // Neumann
       +        if (y == 0 && bc_yn == 2)
       +            dev_scalarfield[idx(x,ny,z)] = val;     // Periodic -y
       +
       +        if (y == ny-1 && bc_yp == 0)
       +            dev_scalarfield[idx(x,ny,z)] = val;     // Dirichlet
       +        if (y == ny-2 && bc_yp == 1)
       +            dev_scalarfield[idx(x,ny,z)] = val;     // Neumann
       +        if (y == ny-1 && bc_yp == 2)
       +            dev_scalarfield[idx(x,-1,z)] = val;     // Periodic +y
        
                // z
                if (z == 0 && bc_bot == 0)
 (DIR) diff --git a/src/version.h b/src/version.h
       t@@ -2,6 +2,6 @@
        #define VERSION_H_
        
        // Define source code version
       -const double VERSION = 2.11;
       +const double VERSION = 2.12;
        
        #endif